windows - Create a backup before deleting each file in a batch file -


i have folder has several files .txt extension. need delete them before need take backup of it.

for example, assume have folder following contents:

name1.txt   name2.txt    name3.txt    name4.txt    

after delete, contents of folder should be:

name1.txt.bkup   name2.txt.bkup   name3.txt.bkup   name4.txt.bkup   

how can done?

just rename .txt-files .txt.bkup, i.e.:

rename *.txt *.txt.bkup 

if insist on creating backups before deleting (for example, configurable batch file, creating backups may switched off), can copy files before deleting:

copy *.txt *.txt.bkup del *.txt 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -