robocopy

Robocopy moves files older than

喜夏-厌秋 提交于 2019-11-29 07:36:29
here is my script to move files older than a certain amount of days- mkdir F:\TempRemoval robocopy "F:\Example" "F:\TempRemoval" /move /e /minage:1 del "F:\TempRemoval\*.*" /f /s /q rmdir F:\TempRemoval /s /q exit The only problem I have is that certain files I need are added into this folder that are 3-4 years old. I know a solution that will work but i'm not sure how to code it. I want robocopy to only search the date up to the first level of folders i.e c:\folders\delete I want it to search the date of only the files and folders listed in "folders" - and move the entire folder and

Batch - Converting variable to uppercase

江枫思渺然 提交于 2019-11-28 13:41:42
How would I go about changing the destl variable to uppercase before it is used. I assume some sort of character swap, however I couldn't get it working. Code is as follows - @echo off echo. set /P "destf=Enter First Name: " set /P "destl=Enter Last Name: " set "findest=Z:\ProjectIT\copy\%destl%, %destf%" robocopy Z:\ProjectIT\copy\test "%findest%" /e /NFL /NDL /NJH /NJS robocopy Z:\ProjectIT\copy\Construction "%findest%"\1-BLANK-%destl% /e /NFL /NDL /NJH /NJS" echo Construction folder has been created for "%destl%" echo. pause I have tried calling something like the following, but could not

ROBOCOPY - Copy folders content to a single folder

自古美人都是妖i 提交于 2019-11-28 07:48:36
Here is some code I made :) @echo off set source="R:\Contracts\" set destination="R:\Contracts\Sites\" ROBOCOPY %source% %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 /S for /r %source in (*) do @copy "%destination" . R:\Contracts\ is full of folders which have files in them. I want to copy all to R:\Contracts\Sites\ and flatten the folder structure. Everything copies well but also the folder structure. Thank you No single command will flatten the hierarchy for you; you will have to use multiple commands. It can be done simply by using FOR /R to walk the hierarchy, coupled with your copy

How to copy files from folder tree dropping all the folders with Robocopy?

烂漫一生 提交于 2019-11-28 06:45:57
I have the following folder structure: FolderA --Folder1 --Folder2 --Folder3 ... --Folder99 Folders 1 through 99 have files in them. All I want to do is to copy ALL THE FILES into ONE FOLDER, basically do a FolderA copy, and wipe out Folders 1-99 keeping all the files. I'd like to do it with Robocopy from cmd.exe if possible (Windows Server 2008) Why use robocopy ? It's a good tool for a specific task but this is not the one. You can simply use what cmd already gives you: for /r %f in (*) do @copy "%f" target This will essentially "flatten" your directory hierarchy. for /r will walk a

How to copy a directory structure but only include certain files (using windows batch files)

冷暖自知 提交于 2019-11-28 02:44:41
As the title says, how can I recursively copy a directory structure but only include some files. E.g given the following directory structure: folder1 folder2 folder3 data.zip info.txt abc.xyz folder4 folder5 data.zip somefile.exe someotherfile.dll The files data.zip and info.txt can appear everywhere in the directory structure. How can I copy the full directory structure, but only include files named data.zip and info.txt (all other files should be ignored)? The resulting directory structure should look like this: copy_of_folder1 folder2 folder3 data.zip info.txt folder4 folder5 data.zip You

Robocopy moves files older than

半城伤御伤魂 提交于 2019-11-28 01:00:24
问题 here is my script to move files older than a certain amount of days- mkdir F:\TempRemoval robocopy "F:\Example" "F:\TempRemoval" /move /e /minage:1 del "F:\TempRemoval\*.*" /f /s /q rmdir F:\TempRemoval /s /q exit The only problem I have is that certain files I need are added into this folder that are 3-4 years old. I know a solution that will work but i'm not sure how to code it. I want robocopy to only search the date up to the first level of folders i.e c:\folders\delete I want it to

Batch - Converting variable to uppercase

廉价感情. 提交于 2019-11-27 07:57:14
问题 How would I go about changing the destl variable to uppercase before it is used. I assume some sort of character swap, however I couldn't get it working. Code is as follows - @echo off echo. set /P "destf=Enter First Name: " set /P "destl=Enter Last Name: " set "findest=Z:\ProjectIT\copy\%destl%, %destf%" robocopy Z:\ProjectIT\copy\test "%findest%" /e /NFL /NDL /NJH /NJS robocopy Z:\ProjectIT\copy\Construction "%findest%"\1-BLANK-%destl% /e /NFL /NDL /NJH /NJS" echo Construction folder has

Copy files without overwrite

风流意气都作罢 提交于 2019-11-27 06:08:17
I just can't seem to find a way on the command line to say "copy all the files from directory A to directory B, but if the file already exists in directory B, don't overwrite it, no matter which file is newer, and don't prompt me." I have been through copy, move, xcopy & robocopy, and the closest I can get is that you can tell robocopy "copy A to B, but don't overwrite newer files with older files," but that doesn't work for me. I looked at xxcopy, but discarded it, as I don't want to have a third-party dependency on a Visual Studio post-build event that will require other SVN users to have

ROBOCOPY - Copy folders content to a single folder

こ雲淡風輕ζ 提交于 2019-11-27 02:03:48
问题 Here is some code I made :) @echo off set source="R:\Contracts\" set destination="R:\Contracts\Sites\" ROBOCOPY %source% %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 /S for /r %source in (*) do @copy "%destination" . R:\Contracts\ is full of folders which have files in them. I want to copy all to R:\Contracts\Sites\ and flatten the folder structure. Everything copies well but also the folder structure. Thank you 回答1: No single command will flatten the hierarchy for you; you will have

How to copy a directory structure but only include certain files (using windows batch files)

*爱你&永不变心* 提交于 2019-11-26 23:48:00
问题 As the title says, how can I recursively copy a directory structure but only include some files. E.g given the following directory structure: folder1 folder2 folder3 data.zip info.txt abc.xyz folder4 folder5 data.zip somefile.exe someotherfile.dll The files data.zip and info.txt can appear everywhere in the directory structure. How can I copy the full directory structure, but only include files named data.zip and info.txt (all other files should be ignored)? The resulting directory structure