Skip to content
/ Poke Public

A simple Windows command-line tool that allows you to create files, modify timestamps, and change file attributes!

License

Notifications You must be signed in to change notification settings

Jettcodey/Poke

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Poke

Poke is a simple Windows command-line utility that mimics the basic functionality of the UNIX touch command. It lets you update access and modification timestamps of files and optionally create files if they don't exist. Additionally, you can set file attributes such as hidden and read-only.

Features

  • Update file access and/or modification times
  • Create new files if they don’t exist
  • Apply custom timestamps or copy from another file
  • Set or remove file attributes like hidden and read-only
  • Supports multiple files and combined short options

Usage

poke [OPTIONS] file [...]

Requirements & Installation

Options

  • -h: Mark the file as hidden.
  • -v: Mark the file as visible (remove the hidden attribute).
  • -o: Mark the file as read-only.
  • -w: Mark the file as writable (remove the read-only attribute).
  • -a: Update the access time only.
  • -m: Update the modification time only.
  • -t STAMP: Use a specific timestamp for the file. The format is [[CC]YY]MMDDhhmm[.ss] (local time).
    • MMDDhhmm: Month, Day, Hour, Minute (uses the current year).
    • YYMMDDhhmm: Two-digit Year, Month, Day, Hour, Minute (interprets years 69-99 as 19xx, 00-68 as 20xx).
    • CCYYMMDDhhmm: Four-digit Century and Year, Month, Day, Hour, Minute.
    • .ss (optional): Seconds (up to two digits).
  • -d DATESTR: Use a specific date and time string. The format is YYYY-MM-DD hh:mm:ss (local time).
  • -r REF_FILE: Use the timestamps from the specified REF_FILE.
  • -c: Do not create the file if it does not exist.
  • --version: Show version information and exit.
  • --help: Show this usage information and exit.

-t, -d, and -r are mutually exclusive. If none are used, the current system time is applied.

Notes

  • If neither -a nor -m is specified, both times are updated.
  • Supports combined short options, e.g., -ho.
  • You can specify multiple files at once.

Examples

  • Update the timestamp of myfile.txt to the current time:

    poke myfile.txt
    
  • Create newfile.txt:

    poke newfile.txt
    
  • Update only the access time of report.docx:

    poke -a report.docx
    
  • Set the timestamp of archive.zip to October 27, 2023 at 10:30 AM:

    poke -t 2310271030 archive.zip
    
  • Set the timestamp of image.png using a specific date and time:

    poke -d "2024-05-15 14:00:00" image.png
    
  • Apply the timestamps from template.txt to document.pdf:

    poke -r template.txt document.pdf
    
  • Mark secret.txt as hidden:

    poke -h secret.txt
    
  • Mark readonly.doc as read-only:

    poke -o readonly.doc
    
  • Do not create missing.log if it doesn't exist:

    poke -c missing.log
    

Build from Source

  1. Prerequisites:

    • Visual Studio 2017 (Community Edition is free) with:

      • VC++ 2017 version 15.9 v14.16 latest v141 tools
      • Windows XP support for C++
    • CMake version 3.10+

  2. Clone the Repository:

    git clone https://github.com/Jettcodey/Poke.git
    cd poke
  3. Generate Build Files:

    For x86:

    mkdir build-x86
    cd build-x86
    cmake -G "Visual Studio 15 2017" -T v141_xp ..

    For x64:

    mkdir build-x64
    cd build-x64
    cmake -G "Visual Studio 15 2017 Win64" -T v141_xp ..
  4. Build

    Debug:

    cmake --build . --config Debug

    Release:

    cmake --build . --config Release

About

A simple Windows command-line tool that allows you to create files, modify timestamps, and change file attributes!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published