Batch file to copy files with date stamp

I have the adhering to network course to copy the file to an archive folder. It copies Data 1 from Folder to Archive yet I would like to include these 2 adjustments that won"t work.

You watching: Batch file to copy files with date stamp

Rename File 1-1 to File 1 - day + timeRunning it now display screens a cmd box through the copy code, is it possibleto run it in the background or have actually a loading screen to display theprogress?

For my code I adhered to this instance to readjust the name to a date.

copy "F:FolderData 1.xlsx" "F:FolderArchiveData 1-1.xlsx"/f "tokens=1-5 delim s=/ " %%d in ("%date%") carry out rename "F:Folder instance 2.xlsx" "F:FolderDocuments example %%e-%%f-%%g.xlsx"

*

*

echo offfor /f "delims=" %%a in ("wmic OS Get localdatetime ^| uncover "."") perform set dt=%%aset YYYY=%dt:~0,4%set MM=%dt:~4,2%set DD=%dt:~6,2%set HH=%dt:~8,2%set Min=%dt:~10,2%collection Sec=%dt:~12,2%set stamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%copy "F:FolderFile 1.xlsx" "F:FolderArchiveData 1 - %stamp%.xlsx"
*

I"ve modified Foxidrive"s answer to copy entire folders and all their contents. this manuscript will create a folder and also backup another folder"s contents right into it, including any type of subfolders underneath.

If you put this in say an hourly reserved job you have to be careful as you could fill up your drive easily through duplicates of your original folder. Before bitbucket and so on i was making use of as comparable script to conserve my code offline.


echo offfor /f "delims=" %%a in ("wmic OS Get localdatetime ^| discover "."") perform collection dt=%%acollection YYYY=%dt:~0,4%set MM=%dt:~4,2%collection DD=%dt:~6,2%collection HH=%dt:~8,2%set Min=%dt:~10,2%collection Sec=%dt:~12,2%collection stamp=YourPrefixHere_%YYYY%%MM%%DD%
%HH%%Min%rem you could for instance want to create a folder in Gdrive and save backup therecd C:YourGoogleDriveFoldermkdir %stamp%cd %stamp% xcopy C:FolderWithDataToBackup*.* /s

*

You can replace the ? via the report name Gross Profit, however it will just rename the one report. The ? renames everything in the Conduit folder. The factor tbelow are so many type of ?, is that some .pdfs have actually lengthy names. If you simply put 12 ?s, then any name much longer than 12 personalities will certainly be clipped off at the 13th character. Try it via 1 ?, then attempt it through many kind of ?s. The ? size must be a small longer or as lengthy as the longest report name.

See more: A Firmware Update Is Needed For Your Security Processor, Surface Pro 3


ECHO OFFSET NETWORKSOURCE=\flcorpfileshared"SHORE Reports"2014ConduitREN %NETWORKSOURCE%*.pdf "????????????????????????????????????????????????? %date:~-4,4%-%date:~-10,2%-%date:~7,2%.pdf"

*

Yes, to make it run in the background develop a shortreduced to the batch file and go right into the properties. I"m on a Linux machine ATM yet I think the option you are wanting is in the progressed tab.

You deserve to additionally run your batch manuscript with a vbs manuscript like this:

"HideBat.vbsCreateObject("Wscript.Shell").Run "your_batch_file.bat", 0, TrueThis will certainly execute your batch file with no cmd home window displayed.


Thanks for contributing an answer to Stack Overflow!

Please be certain to answer the question. Provide details and share your research!

But avoid

Asking for help, clarification, or responding to various other answers.Making statements based upon opinion; earlier them up via references or personal experience.

See more: Windows 10 Audio Cuts Out Randomly, Audio Keeps Cutting Out On New Laptop

To learn even more, watch our tips on composing great answers.


Article Your Answer Discard

By clicking “Blog post Your Answer”, you agree to our terms of company, privacy policy and also cookie policy


Not the answer you're looking for? Browse various other concerns tagged home windows batch-file windows-vista or ask your own question.


Create batch file for copy all the consisted of in root folder (consisting of folder and files) to one more folder
site style / logo design © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.4.1.38970


Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your tool and also disclose indevelopment in accordance via our Cookie Policy.