Hey,
i want to copy a Folder every time i start the Script. In this folder are 10 sub-folders.
I want to copy the content of the folder but he shoudnt overwrite one sub-folder.
How do i do this?
I use
FileCopyDir D:\%Name%\ , C:\%Name%\,1
How can i tell him to not overwrite a sub-folder named "INI"?
Do i have to use 10x FileCopyDir for the 10 sub-folders and use 9x the "1" parameter for overwrite and 1x the "0" parameter to not overwrite?
FileCopyDir D:\%Name%\1\ , C:\%Name%\1\,1
FileCopyDir D:\%Name%\2\ , C:\%Name%\2\,1
FileCopyDir D:\%Name%\3\ , C:\%Name%\3\,1
FileCopyDir D:\%Name%\4\ , C:\%Name%\4\,1
...
FileCopyDir D:\%Name%\INI\ , C:\%Name%\INI\,0
FileCopyDir - overwrite every sub-folder except one
-
- Posts: 10
- Joined: 06 Oct 2016, 03:38
Re: FileCopyDir - overwrite every sub-folder except one
I'm not sure which you want...
The first script uses ternary to switch the "Overwrite" flag between 1 or 0 depending on if the folder name is "INI" or not.
The second script will just skip copying the INI folder completely, and copy the other folders only.
Hope that helps!
The first script uses ternary to switch the "Overwrite" flag between 1 or 0 depending on if the folder name is "INI" or not.
The second script will just skip copying the INI folder completely, and copy the other folders only.
Hope that helps!
Code: Select all
#SingleInstance, Force
Name := "Test"
Loop, Files, J:\%Name%\*.*, D
{
FileCopyDir, % A_LoopFileLongPath, % StrReplace(A_LoopFileLongPath, "J:\", "C:\"), % (A_LoopFileName = "INI" ? 0 : 1)
}
Code: Select all
#SingleInstance, Force
Name := "Test" ; Folder Name
Loop, Files, D:\%Name%\*.*, D
{
If (A_LoopFileName = "INI") {
Continue
}
FileCopyDir, % A_LoopFileLongPath, % StrReplace(A_LoopFileLongPath, "D:\", "C:\"), 1
}
-
- Posts: 10
- Joined: 06 Oct 2016, 03:38
Re: FileCopyDir - overwrite every sub-folder except one
great, both works.
but what about the files in my main folder?
this one only copies the sub-folders.
but what about the files in my main folder?
this one only copies the sub-folders.
-
- Posts: 10
- Joined: 06 Oct 2016, 03:38
Re: FileCopyDir - overwrite every sub-folder except one
i solved it this way.
now iam working with extension
Loop, Files, J:\*, R
FileCopy, % A_LoopFileLongPath, % StrReplace(A_LoopFileLongPath, "J:\", "C:\"), % (A_LoopFileExt = "ini" ? 0 : 1)
now iam working with extension
Loop, Files, J:\*, R
FileCopy, % A_LoopFileLongPath, % StrReplace(A_LoopFileLongPath, "J:\", "C:\"), % (A_LoopFileExt = "ini" ? 0 : 1)
-
- Posts: 10
- Joined: 06 Oct 2016, 03:38
Re: FileCopyDir - overwrite every sub-folder except one
my method doesnt work that well...
now it only copies files into the sub-folders if they already exist. but if there is no sub-folder then he doesnt copy the files into it
now it only copies files into the sub-folders if they already exist. but if there is no sub-folder then he doesnt copy the files into it
Who is online
Users browsing this forum: Google [Bot], jaka1, marypoppins_1, mikeyww, usser, wilkster and 141 guests