Page 1 of 1

Moving files but keeping parent name

Posted: 07 Sep 2018 04:11
by CookieMonster
I want to move files from multiple sub-folders of the same name, to another folder on another drive; but create new sub-folders in the other folder for which the files are moved too, but with the same name of the parent folder name for which the files are moving from.

Re: Moving files but keeping parent name

Posted: 07 Sep 2018 07:42
by highend
And?

Define a $src and a $dst folder
Count the number of "\" via gettoken() for $src
Get the necessary folders from $src via quicksearch()

The foreach loop:
Count the number of "\" for the current folder and compare it with the value from above and skip via continue
(the first layer of folders should not be processed)!
Get the parent of each folder via getpathcomponent()
Get each folder's files via quicksearch() or listfolder()
Construct the final destination path and move them via moveto

Go for it...

Re: Moving files but keeping parent name

Posted: 09 Sep 2018 05:19
by CookieMonster
$src & $dst are variables, not known variables, correct ?

Re: Moving files but keeping parent name

Posted: 09 Sep 2018 10:27
by highend
What are "known variables"?

Re: Moving files but keeping parent name

Posted: 09 Sep 2018 17:35
by CookieMonster
Where can I find, known variables in the documentation ?

Re: Moving files but keeping parent name

Posted: 09 Sep 2018 18:11
by highend
Advanced Topics - Variables? oO