script to copy sevaral folder contents into one folder
Re: script to copy sevaral folder contents into one folder
Is it reproducable (same file, produces the same error)?
I can't see anything wrong inside the script.
I can't see anything wrong inside the script.
One of my scripts helped you out? Please donate via Paypal
Re: script to copy sevaral folder contents into one folder
error is repeating in other systems also. i have checked in win7 32 bit and win 7 64 bit systems, but the error is popping up again.
case : i have created one folder called test. within test folder i have file ClavierHelp.html.pdf
and folder ClavierHelp.html - Copy (2). folder ClavierHelp.html - Copy (2) has ClavierHelp.html - Copy (2).pdf file. when i have used your code on test folder, the following errors popped up.
case : i have created one folder called test. within test folder i have file ClavierHelp.html.pdf
and folder ClavierHelp.html - Copy (2). folder ClavierHelp.html - Copy (2) has ClavierHelp.html - Copy (2).pdf file. when i have used your code on test folder, the following errors popped up.
- Attachments
-
- Clipboard02.jpg (103.64 KiB) Viewed 3492 times
-
- Clipboard01.jpg (51.75 KiB) Viewed 3492 times
Re: script to copy sevaral folder contents into one folder
Code: Select all
/* 05.11.2011, Move files and contents of folders to a different (new) folder
::load "<xyscripts>\.snippets\MoveToNewDestination.xys";
*/
setting('BackgroundFileOps', 0);
$destination = inputfolder( ,select destination folder to move to);
$FolderList = get("SelectedItemsPathNames", "|");
foreach($FLD, $FolderList)
{
if (exists($FLD)==2)
{
$content = folderreport("files", "r", $FLD, "r", , "|");
foreach($Item, $content)
{
moveto $destination, $Item;
}
} else {
moveto $destination, $FLD;
}
delete 1, 0, $FLD;
}
One of my scripts helped you out? Please donate via Paypal
Re: script to copy sevaral folder contents into one folder
wonderful sir, the code is perfectly working as i desired. you are really a genius.
Re: script to copy sevaral folder contents into one folder
i have modified the above code to type the destination folder as follows. it is working. now can i have the two options ie. either browse or type the path in this code.
/* 05.11.2011, Move files and contents of folders to a different (new) folder
::load "<xyscripts>\.snippets\MoveToNewDestination.xys";
*/
setting('BackgroundFileOps', 0);
$destination = input("Enter target path");
$FolderList = get("SelectedItemsPathNames", "|");
foreach($FLD, $FolderList)
{
if (exists($FLD)==2)
{
$content = folderreport("files", "r", $FLD, "r", , "|");
foreach($Item, $content)
{
moveto $destination, $Item;
}
} else {
moveto $destination, $FLD;
}
delete 1, 0, $FLD;
}
/* 05.11.2011, Move files and contents of folders to a different (new) folder
::load "<xyscripts>\.snippets\MoveToNewDestination.xys";
*/
setting('BackgroundFileOps', 0);
$destination = input("Enter target path");
$FolderList = get("SelectedItemsPathNames", "|");
foreach($FLD, $FolderList)
{
if (exists($FLD)==2)
{
$content = folderreport("files", "r", $FLD, "r", , "|");
foreach($Item, $content)
{
moveto $destination, $Item;
}
} else {
moveto $destination, $FLD;
}
delete 1, 0, $FLD;
}
Re: script to copy sevaral folder contents into one folder
Can you please use code tags and indent as appropriate? Makes code easier to read and understand.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build
Windows 7/10
Always using the latest stable two-decimal build
Re: script to copy sevaral folder contents into one folder
i have added two options. 1. Browse for folder, 2. Type Path. With the help of stefan sir's code i could modify the above code as follows.
the above code i am using regularly. it has made my day.
Code: Select all
/* 18.11.2011, Move files and contents of folders to a different (new) folder
::load "<xyscripts>\.snippets\MoveToNewDestination.xys";
*/
$Methode = inputselect(Choose methode for Moving files:, "Browse|Type Path", , 2);
if ($Methode=="Type Path"){
setting('BackgroundFileOps', 0);
$destination = input("Enter target path");
$FolderList = get("SelectedItemsPathNames", "|");
foreach($FLD, $FolderList)
{
if (exists($FLD)==2)
{
$content = folderreport("files", "r", $FLD, "r", , "|");
foreach($Item, $content)
{
moveto $destination, $Item;
}
} else {
moveto $destination, $FLD;
}
delete 1, 0, $FLD;
}
}
else{
setting('BackgroundFileOps', 0);
$destination = inputfolder( ,select destination folder to move to);
$FolderList = get("SelectedItemsPathNames", "|");
foreach($FLD, $FolderList)
{
if (exists($FLD)==2)
{
$content = folderreport("files", "r", $FLD, "r", , "|");
foreach($Item, $content)
{
moveto $destination, $Item;
}
} else {
moveto $destination, $FLD;
}
delete 1, 0, $FLD;
}
}
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Re: script to copy sevaral folder contents into one folder
Kotlmg, consider using the revised code below:kotlmg wrote:i have added two options. 1. Browse for folder, 2. Type Path. With the help of stefan sir's code i could modify the above code as follows.
Code: Select all
/* 18.11.2011, Move files and contents of folders to a different (new) folder ::load "<xyscripts>\.snippets\MoveToNewDestination.xys"; */ ...
Code: Select all
/* 18.11.2011, Move files and contents of folders to a different (new) folder
::load "<xyscripts>\.snippets\MoveToNewDestination.xys";
*/
$Methode = inputselect(Choose methode for Moving files:, "Browse|Type Path", , 2);
if ($Methode=="Type Path"){
$destination = input("Enter target path");
} else {
$destination = inputfolder( ,select destination folder to move to);
}
setting('BackgroundFileOps', 0);
$FolderList = get("SelectedItemsPathNames", "|");
foreach($FLD, $FolderList)
{
if (exists($FLD)==2)
{
$content = folderreport("files", "r", $FLD, "r", , "|");
foreach($Item, $content)
{
moveto $destination, $Item;
}
} else {
moveto $destination, $FLD;
}
delete 1, 0, $FLD;
}
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
Re: script to copy sevaral folder contents into one folder
thanks Zardoz2293. your code is perfectly working.
Re: script to copy sevaral folder contents into one folder
Hello,
I would like to use this script but I don't want it to delete anything but just to move content: is it possible?
Thank you.
I would like to use this script but I don't want it to delete anything but just to move content: is it possible?
Thank you.
Re: script to copy sevaral folder contents into one folder
Delete the delete... line?!?
Code: Select all
delete 1, 0, $FLD;
One of my scripts helped you out? Please donate via Paypal
Re: script to copy sevaral folder contents into one folder
If I knew what to do or understood coding I wouldn't be asking in the first place.highend wrote:Delete the delete... line?!?
Code: Select all
delete 1, 0, $FLD;
What about those } at the end?
Do they remain so that it looks like this?
} else {
moveto $destination, $FLD;
}
}
Thank you
Re: script to copy sevaral folder contents into one folder
Yeah.Do they remain?
One of my scripts helped you out? Please donate via Paypal
Re: script to copy sevaral folder contents into one folder
Thanks but proving I am no expert I cannot seem to make it work.highend wrote:Yeah.Do they remain?
I placed a button on the Toolbar and in "On Click" I placed the code minus the delete 1, 0, $FLD;
When I click on the button I get a dropdown with some of the code: what am I doing wrong?
Thank you
Re: script to copy sevaral folder contents into one folder
Probably because you have copied one of the later postings that showed the code in code tags.
Each line of the code must be preceeded with at least a space (or in my case: a tab) as a general rule
(excluding the first line, comments or subcode).
The last two code postings don't obey this rule and you have to reindent it yourself.
Each line of the code must be preceeded with at least a space (or in my case: a tab) as a general rule
(excluding the first line, comments or subcode).
The last two code postings don't obey this rule and you have to reindent it yourself.
One of my scripts helped you out? Please donate via Paypal