Search : in
By :

Copy file with timestamp

SenHu, on May 23, 2009 5:40:07 pm BST 
 Report this message to moderators

Hello,

Someone asked this question.

I need to copy a file C:\folder1\file1 to folder C:\folder2 but copy it with a timestamp added to the filename.

I currently have a schedule that copies the file to the folder but I need to retain other files already copied
and not overwrite them.




Following biterscript will do it.





# Start of script copyfile.txt
# Set source file to copy
var str source ; set $source = "C:\folder1\file1"

# Get the file name from the full path.
var str file ; stex "^\\^l[" $source > $file

# Set destination. It contains file name, an underscore, then timestamp.
var str dest ; set $dest = "C:\folder2"+"\\"+$file+"_"+gettime()

# Copy source to destination.
system copy ("\""+$source+"\"") ("\""+$dest+"\"")
# End of script copyfile.txt






You can schedule the script to run periodically. Save the above script in C:/Scripts/copyfile.txt. Schedule
the following command in task scheduler





C:\biterScripting\biterScripting.exe copyfile.txt




To download biterscripting , follow installation instructions at http://www.biterscripting.com/install.html . It's free.

Sen

Best answers for « Copy file with timestamp » in :
Batch Script - Move files to \%date%\%time%\ ShowBatch Script - Move files to \%date%\%time%\ Issue Solution Note Issue I have been trying to make a simple batch script to create database backups and move then into a folder named by date, and a sub folder by time. This is what I...
Writing in batch in text file ShowWriting in batch in text file To write in a file text, you just have to use a redirect: echo text > output_file.txt To write in an existing file: echo " Write at the end of the file ">> output_file.txt
[MS-Dos]List the contents of a directory in a file Show[MS-Dos]List the contents of a directory in a file Intro Explanation Intro It may be convenient to make the listing of one or more directories in a file, to make a catalog of files. Under MS-DOS (or Windows by opening a...
Download Teracopy ShowTeraCopy is a compact program designed to copy and move files at the maximum possible speed.It is free for Home Users. Features: Copy files faster. TeraCopy uses dynamically adjusted buffers to reduce seek times. Asynchronous copy speeds up...
Download PDFKey Pro ShowDescription The application is designed by briksoftware groups. PDFKey Pro is a tool that allows you to manage your PDF file. It allows you to unlock your document with a password and protect them against copying. Files that are generated by the...
Download GrandBackup Personal ShowGrandBackup Personal is a program for transferring files and folders. It allows you to copy files and folders from one location to another on the same drive, another drive or over a network. Advantage You can define tasks that define the location...
File sharing in Windows XP ShowAdvantages File sharing involves making the content of one or more directories available through the network. All Windows systems have standard devices making it easy to share the content of a directory. However, file sharing may lead to security...
The file system ShowWhat is a file system? Even though hard drives can be very small, they still contain millions of bits and therefore need to be organised so that information can be located. This is the purpose of the file system. Remember that a hard drive is made...
UNIX - Files ShowIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different...