Yes, there are solutions without using Python. You can achieve this using a combination of batch scripts and for the automated interval solution, or using a tool like AutoHotkey for the key-press solution.
Solution 1: Automated Interval with Batch Script and Task Scheduler
Create the Batch Script:Create a batch file (e.g.,copy_with_timestamp.bat) with the following content:batchCopy code@echo off
set source_file="C:\path\to\your\source\file.txt" rem Replace with your source file path
set destination_folder="C:\path\to\your\destination\folder" rem Replace with your destination folder path
for /f "tokens=1-4 delims=/- " %%a in ('date /t') do (
set dow=%%a
set month=%%b
set day=%%c
set year=%%d
)
for /f "tokens=1-2 delims=:. " %%a in ('time /t') do (
set hour=%%a
set minute=%%b
)
set timestamp=%year%%month%%day%%hour%%minute%
set base_filename=%~n1
set extension=%~x1
set new_filename=%base_filename%_%timestamp%%extension%
set destination_file=%destination_folder%%new_filename%
copy %source_file% %destination_file%
echo Copied %source_file% to %destination_file%
Set Up Task Scheduler:Open Task Scheduler (typeTask Schedulerin the Windows search bar).Select "Create Basic Task" from the Actions pane.Name your task (e.g., "CopyFileWithTimestamp") and provide a description.Choose "Daily" for the task trigger, and then set the start time.On the "Daily" settings, select "Repeat task every" and set it to 5 minutes. Set the duration to "Indefinitely".Choose "Start a Program" for the action.Browse to the batch file you created and select it.Finish the wizard and make sure the task is enabled.
Open Task Scheduler (typeTask Schedulerin the Windows search bar).
Select "Create Basic Task" from the Actions pane.
Name your task (e.g., "CopyFileWithTimestamp") and provide a description.
Choose "Daily" for the task trigger, and then set the start time.
On the "Daily" settings, select "Repeat task every" and set it to 5 minutes. Set the duration to "Indefinitely".
Choose "Start a Program" for the action.
Browse to the batch file you created and select it.
Finish the wizard and make sure the task is enabled.
Create the Batch Script:Create a batch file (e.g.,copy_with_timestamp.bat) with the following content:
────────────────────────────────────────────────────────────────────
batchCopy code@echo off
set source_file="C:\path\to\your\source\file.txt" rem Replace with your source file path
set destination_folder="C:\path\to\your\destination\folder" rem Replace with your destination folder path
for /f "tokens=1-4 delims=/- " %%a in ('date /t') do (
set dow=%%a
set month=%%b
set day=%%c
set year=%%d
)
for /f "tokens=1-2 delims=:. " %%a in ('time /t') do (
set hour=%%a
set minute=%%b
)
set timestamp=%year%%month%%day%%hour%%minute%
set base_filename=%~n1
set extension=%~x1
set new_filename=%base_filename%_%timestamp%%extension%
set destination_file=%destination_folder%%new_filename%
copy %source_file% %destination_file%
echo Copied %source_file% to %destination_file%
Set Up Task Scheduler:
Open Task Scheduler (typeTask Schedulerin the Windows search bar).
Select "Create Basic Task" from the Actions pane.
Name your task (e.g., "CopyFileWithTimestamp") and provide a description.
Choose "Daily" for the task trigger, and then set the start time.
On the "Daily" settings, select "Repeat task every" and set it to 5 minutes. Set the duration to "Indefinitely".
Choose "Start a Program" for the action.
Browse to the batch file you created and select it.
Finish the wizard and make sure the task is enabled.
Open Task Scheduler (typeTask Schedulerin the Windows search bar).
Select "Create Basic Task" from the Actions pane.
Name your task (e.g., "CopyFileWithTimestamp") and provide a description.
Choose "Daily" for the task trigger, and then set the start time.
On the "Daily" settings, select "Repeat task every" and set it to 5 minutes. Set the duration to "Indefinitely".
Choose "Start a Program" for the action.
Browse to the batch file you created and select it.
Finish the wizard and make sure the task is enabled.
Solution 2: Key-Press with AutoHotkey
Install AutoHotkey:Download and install AutoHotkey fromautohotkey.com.
Create the AutoHotkey Script:Create a script (e.g.,copy_on_keypress.ahk) with the following content:ahkCopy code; Set the source file and destination folder
source_file := "C:\path\to\your\source\file.txt" ; Replace with your source file path
destination_folder := "C:\path\to\your\destination\folder" ; Replace with your destination folder path
; Function to copy file with timestamp
CopyFileWithTimestamp() {
global source_file, destination_folder
FormatTime, timestamp,, yyyyMMddHHmmss
SplitPath, source_file, , , extension, filename_no_ext
new_filename := filename_no_ext "_" timestamp "." extension
destination_file := destination_folder "" new_filename
FileCopy, %source_file%, %destination_file%
MsgBox, Copied %source_file% to %destination_file%
}
; Hotkey to copy the file (Ctrl+C)
^CopyFileWithTimestamp()
; Hotkey to exit the script (Ctrl+Q)
^qExitApp
Running the AutoHotkey Script:Save the script with a.ahkextension.Double-click the script to run it. This will place an AutoHotkey icon in your system tray.PressCtrl+Cto copy the file with a timestamp. The script will show a message box confirming the action.PressCtrl+Qto exit the script.
Save the script with a.ahkextension.
Double-click the script to run it. This will place an AutoHotkey icon in your system tray.
PressCtrl+Cto copy the file with a timestamp. The script will show a message box confirming the action.
PressCtrl+Qto exit the script.
Install AutoHotkey:Download and install AutoHotkey fromautohotkey.com.
Create the AutoHotkey Script:Create a script (e.g.,copy_on_keypress.ahk) with the following content:
────────────────────────────────────────────────────────────────────
ahkCopy code; Set the source file and destination folder
source_file := "C:\path\to\your\source\file.txt" ; Replace with your source file path
destination_folder := "C:\path\to\your\destination\folder" ; Replace with your destination folder path
; Function to copy file with timestamp
CopyFileWithTimestamp() {
global source_file, destination_folder
FormatTime, timestamp,, yyyyMMddHHmmss
SplitPath, source_file, , , extension, filename_no_ext
new_filename := filename_no_ext "_" timestamp "." extension
destination_file := destination_folder "" new_filename
FileCopy, %source_file%, %destination_file%
MsgBox, Copied %source_file% to %destination_file%
}
; Hotkey to copy the file (Ctrl+C)
^CopyFileWithTimestamp()
; Hotkey to exit the script (Ctrl+Q)
^qExitApp
Running the AutoHotkey Script:
Save the script with a.ahkextension.
Double-click the script to run it. This will place an AutoHotkey icon in your system tray.
PressCtrl+Cto copy the file with a timestamp. The script will show a message box confirming the action.
PressCtrl+Qto exit the script.
Save the script with a.ahkextension.
Double-click the script to run it. This will place an AutoHotkey icon in your system tray.
PressCtrl+Cto copy the file with a timestamp. The script will show a message box confirming the action.
PressCtrl+Qto exit the script.
These solutions provide a way to automate the file copying and renaming process using either scheduled tasks or key-presses without relying on Python.