![]() ![]() ![]() if you have "exampleA" in your names.txt file, but already haveĭepending on your usage, you could consider saving the names of the files it couldn't make. If the file name already exists, it just doesn't copy. It also checks if the path you're trying to write to exists already. The place you want to copy it to (leave empty if you want it to copy in the folder the Powershell is currently in with cd) (line 2) I added some more stuff to this script so there is less work for you to do. If(($name -match $regex) -And (!::Exists($pathToCopyTo)))Ĭopy-Item $fileToCopy -Destination $placeToCopyTo$name.$fileExtension $pathToCopyTo = "$placeToCopyTo$name.$fileExtension" (posted previously) in Powershell would be: That seems to use a different syntax as compared to Powershell.įOR /F %i IN (names.txt) DO copy /y FileToCopy.txt files\%i.txt Thanks for reply, but somehow I do not get it right, I attached image, could you please check, what am I doing it wrong? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |