![]() In this article, we are going to take a look at Robocopy with the help of commonly used examples. Increase Copy Speed with Multi-Threading.Copy Contents without Empty Directories.Hopefully when you jump into powershell you'll find debugging using powershell ISE and the syntax used much more simple. You just have to research away and just do your own testing to see what happens until you get it to do what you want. If all this syntax seems really weird to you, you're not alone. You have to add the enabledelayedexpansion as well so that you can use the found variable in different blocks, then you have to call !found! instead of %found% to use it. The way I've written it above basically says recurse all folders in the parent directory and set %%G to that location (.). Using the /D option in the for loop attaches the current directory where you're running the script to the %%G variable which I don't think is what you want. SETLOCAL EnableExtensions enabledelayedexpansion You'll need to tweak it for your specific case. I've tested this locally and it seems to work for what you are doing. There might be a command to move all files with multiple extensions at once, but from what I understand that syntax isn't usually available for move in most versions of DOS. In my opinion it's cleaner and more simple to do things like this with less lines of code. I would suggest looking into powershell scripts for things like this. The G can be any character, but it can't be more than one character. I'm not sure what /B is, that doesn't look right to me. If you want to keep the message saying nothing to move, you can always set some variable if it gets inside one of those IF statements and check that it's set. So inside your loop it would look like this: IF exist "%%G\*.pdf" ( Hopefully that's enough info, can edit as needed for more info.Īll you need to do is make multiple if statements I would think. Line 7 do I want to use move or something else, and what's the /B parameter? /y is the only one I know of for move.Line 6 how do I specify the other file extensions I want to look for?.Line 5 is %%G correct? Does it matter what the letter is?.Line 4 should set the destination for example folder "parent2" as "c:\archive".Line 3 I believe that sets "c:\logs\cache\" as the parent folder, so in my example about that would equal "parent1".So far I'm looking at something like this: OFFĮcho nothing to copy "%%~G\*.pdf" "%_parent%\" Especially where I need to cover several file types. Is one example I looked at, and I looked over the suggested reading, but I totally don't get how the parameters and variables work. Moving pdf files to parent folder from subfolder with variable names ![]() So I've searched around for other answers and it looks like I need some sort of FOR loop, but I don't understand enough of how that works with parameters to do what I need. Then log the subfolder directory names (results-log.log) and delete the subfolders and everything left in them. So that I have one folder with just the files I want, leaving behind any other file types. ![]() Move the files with extensions: *.exe *.pdf *.avi or other specified extentions out of the subfolders and into a common separate folder without recreating the previous folder structure. ![]() Some I want to retain, others can be deleted. Numerous sub-folders with random folder names containing several files with random names. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |