Copying files

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
joan28
Posts: 12
Joined: 13 Nov 2009 22:16

Copying files

Post by joan28 »

I try to describe my problem.
I have a list of files with paths from different places on the hard drive which I need to copy or move to another location (different drive, kind of back up) preserving folder structure.
To make things clear-this list covers only part of files existing on the hard drive with different extensions.
As there are many of them I don't want to do it one by one manually and I am looking for the solution like a script or something.
I have tried to make a batch file to run it in the DOS box but DOS doesn't maintain unicode in names of files and folders what makes this method useless.
Is any way to do it with XYplorer? Or any other suggestion?
Any help will be much appreciated.
Thanx :)

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Copying files

Post by admin »

Hello and welcome,

have a look at "Rich Copy" in the help file.

come back when you have further questions...

Don

joan28
Posts: 12
Joined: 13 Nov 2009 22:16

Re: Copying files

Post by joan28 »

Thanx a lot for the answer.
I have read the Rich Copy's description and it seems interesting.
Anyway it allows to copy files one by one only not in the way I need: copying files based on their list.
Am I mistaken?

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Copying files

Post by admin »

joan28 wrote:Thanx a lot for the answer.
I have read the Rich Copy's description and it seems interesting.
Anyway it allows to copy files one by one only not in the way I need: copying files based on their list.
Am I mistaken?
How does this list look?

joan28
Posts: 12
Joined: 13 Nov 2009 22:16

Re: Copying files

Post by joan28 »

Sorry for the late answer

The list of files is the plain list with paths and file names like this:

Code: Select all

C:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
C:\WINDOWS\Driver Cache\i386\mxdwdui.ini
C:\WINDOWS\Resources\Themes\Luna.theme
C:\WINDOWS\Resources\Themes\Windows Classic.theme
For back-up purposes it needs to be copied or moved somewhere (another drive or any other place) preserving folder structure. Like in this example:

Code: Select all

E:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
E:\WINDOWS\Driver Cache\i386\mxdwdui.ini
E:\WINDOWS\Resources\Themes\Luna.theme
E:\WINDOWS\Resources\Themes\Windows Classic.theme
And this is all.
To give some comments more: usually everyone has to make a back-up (or at least should make :lol: ). The fastes way is to copy only sensitive or the most important files as the main reason why people don't make back-ups is the long time needed to copy everything.
So creating such list and make it fast and easy is a way to go.

Another example which shows why such possibility is very important for almost everybody is keeping up-to-date files on the pendrive. Fast and easy copying or moving chosen files from one place to the stick based on created simple list can be done by almost everyone.

I am pretty sure such possibility is more important then you can think for many everyday purposes.

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Copying files

Post by admin »

joan28 wrote:Sorry for the late answer

The list of files is the plain list with paths and file names like this:

Code: Select all

C:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
C:\WINDOWS\Driver Cache\i386\mxdwdui.ini
C:\WINDOWS\Resources\Themes\Luna.theme
C:\WINDOWS\Resources\Themes\Windows Classic.theme
For back-up purposes it needs to be copied or moved somewhere (another drive or any other place) preserving folder structure. Like in this example:

Code: Select all

E:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
E:\WINDOWS\Driver Cache\i386\mxdwdui.ini
E:\WINDOWS\Resources\Themes\Luna.theme
E:\WINDOWS\Resources\Themes\Windows Classic.theme
And this is all.
To give some comments more: usually everyone has to make a back-up (or at least should make :lol: ). The fastes way is to copy only sensitive or the most important files as the main reason why people don't make back-ups is the long time needed to copy everything.
So creating such list and make it fast and easy is a way to go.

Another example which shows why such possibility is very important for almost everybody is keeping up-to-date files on the pendrive. Fast and easy copying or moving chosen files from one place to the stick based on created simple list can be done by almost everyone.

I am pretty sure such possibility is more important then you can think for many everyday purposes.
Yes, I see good potential here. If you are happy with pasting the list of items then the interface could look like Edit | New | New Folders.... The new command could be Edit | Backup Here... (applying the settings from Configuration | Backup & Report).

Another way would be a (new or extended) scripting command (e.g. backupto) that would take a TXT file (containing the list of items) as source. Or simply extending the existing source parameter like this;

Code: Select all

backupto location, [source]
source: if "file:*" the it points to a file containing a list of items, else it is the list itself
Or do you have yet another idea for handling it?

BTW, the Catalog already allows for what you want:
1. Paste your list of items to the clipboard
2. Fill your list into a Category by doing "Insert as new Category / Clipboard Item(s)" from Catalog context menu
3. Select that Category
4. Do Edit | Backup To...
But I would agree that it is somewhat clumsy and abusive of the Catalog.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Copying files

Post by jacky »

admin wrote:Yes, I see good potential here. If you are happy with pasting the list of items then the interface could look like Edit | New | New Folders.... The new command could be Edit | Backup Here... (applying the settings from Configuration | Backup & Report).

Another way would be a (new or extended) scripting command (e.g. backupto) that would take a TXT file (containing the list of items) as source. Or simply extending the existing source parameter like this;

Code: Select all

backupto location, [source]
source: if "file:*" the it points to a file containing a list of items, else it is the list itself
hmm... aren't you forgetting one little thing here: backupto is not a Rich Operation so all files would be in the same (destination) folder, whereas here joan28 is trying to preserve the folder structure obviously -- or were you planning to add "Rich Operation support" to backupto ?

Anyways, using a simple copy something similar can already be done somewhat easily. Select the text file containing a list of files to copy, and launch this script:

Code: Select all

copyto inputfolder(<curpath>, 'Select destination folder'), replace(readfile(), <crlf>, '|'), Computer;
It will ask for the destination folder, then copy all files while preserving the folder structure. So using the list posted above, and using E:\ as destination folder, the copied files should be as follow:

Code: Select all

E:\C\WINDOWS\Driver Cache\i386\msxpsinc.ppd
E:\C\WINDOWS\Driver Cache\i386\mxdwdui.ini
E:\C\WINDOWS\Resources\Themes\Luna.theme
E:\C\WINDOWS\Resources\Themes\Windows Classic.theme
Not exactly what was asked, but damn close ;) (Of course, I'm all for adding Rich Operation support to backupto!)

Note: in the script I used Computer as source for the Rich Copy, but that is for Win7. I think for older Windows one needs to replace it with "My Computer" in order to work.

BTW & slightly OT, is there/could there be some environment/XY variable or something one could use (in XY scripting as well as locations, e.g. destination of a Catalog item) so that it would always point to (My) Computer no matter how Windows calls it this time (I'm not even sure how it works in other language actually...) ?
Proud XYplorer Fanatic

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Copying files

Post by admin »

jacky wrote:
admin wrote:Yes, I see good potential here. If you are happy with pasting the list of items then the interface could look like Edit | New | New Folders.... The new command could be Edit | Backup Here... (applying the settings from Configuration | Backup & Report).

Another way would be a (new or extended) scripting command (e.g. backupto) that would take a TXT file (containing the list of items) as source. Or simply extending the existing source parameter like this;

Code: Select all

backupto location, [source]
source: if "file:*" the it points to a file containing a list of items, else it is the list itself
hmm... aren't you forgetting one little thing here: backupto is not a Rich Operation so all files would be in the same (destination) folder, whereas here joan28 is trying to preserve the folder structure obviously -- or were you planning to add "Rich Operation support" to backupto ?

Anyways, using a simple copy something similar can already be done somewhat easily. Select the text file containing a list of files to copy, and launch this script:

Code: Select all

copyto inputfolder(<curpath>, 'Select destination folder'), replace(readfile(), <crlf>, '|'), Computer;
It will ask for the destination folder, then copy all files while preserving the folder structure. So using the list posted above, and using E:\ as destination folder, the copied files should be as follow:

Code: Select all

E:\C\WINDOWS\Driver Cache\i386\msxpsinc.ppd
E:\C\WINDOWS\Driver Cache\i386\mxdwdui.ini
E:\C\WINDOWS\Resources\Themes\Luna.theme
E:\C\WINDOWS\Resources\Themes\Windows Classic.theme
Not exactly what was asked, but damn close ;) (Of course, I'm all for adding Rich Operation support to backupto!)

Note: in the script I used Computer as source for the Rich Copy, but that is for Win7. I think for older Windows one needs to replace it with "My Computer" in order to work.

BTW & slightly OT, is there/could there be some environment/XY variable or something one could use (in XY scripting as well as locations, e.g. destination of a Catalog item) so that it would always point to (My) Computer no matter how Windows calls it this time (I'm not even sure how it works in other language actually...) ?
Thanks jacky for correcting my nonsense + coming coming up with a solution.
I will think about adding Rich Operation support to backupto. Remind if I forget...

The variable is there already: %computer%

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Copying files

Post by jacky »

admin wrote:The variable is there already: %computer%
Ah good, thanks, didn't know that one!
Proud XYplorer Fanatic

joan28
Posts: 12
Joined: 13 Nov 2009 22:16

Re: Copying files

Post by joan28 »

Or do you have yet another idea for handling it?
Just a one suggestion.
There is a command File->File Special->...
which contains some file operations.
As nobody knows which ideas can be implemented in the future I think this is a good place for such purposes.
Also except copying, moving files can be useful in some cases so maybe this command can be used too.

Thanx for the support guys :)

admin
Site Admin
Posts: 66324
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Copying files

Post by admin »

joan28 wrote:
Or do you have yet another idea for handling it?
Just a one suggestion.
There is a command File->File Special->...
which contains some file operations.
As nobody knows which ideas can be implemented in the future I think this is a good place for such purposes.
Also except copying, moving files can be useful in some cases so maybe this command can be used too.

Thanx for the support guys :)
I will try to add something like that in 8.80...

What would think of a list format where the first line is the target path, the second line the relative source root (used for the Rich Copy), and the following lines are the items to copy. Your example would look like this:

Code: Select all

E:\
C:\
C:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
C:\WINDOWS\Driver Cache\i386\mxdwdui.ini
C:\WINDOWS\Resources\Themes\Luna.theme
C:\WINDOWS\Resources\Themes\Windows Classic.theme
And would result in this (as you desired):

Code: Select all

E:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
E:\WINDOWS\Driver Cache\i386\mxdwdui.ini
E:\WINDOWS\Resources\Themes\Luna.theme
E:\WINDOWS\Resources\Themes\Windows Classic.theme

Or maybe a bit more explicit and human friendly (now with root=C:\WINDOWS\ to demonstrate the effect of a different root):

Code: Select all

target=E:\
root=C:\WINDOWS\
C:\WINDOWS\Driver Cache\i386\msxpsinc.ppd
C:\WINDOWS\Driver Cache\i386\mxdwdui.ini
C:\WINDOWS\Resources\Themes\Luna.theme
C:\WINDOWS\Resources\Themes\Windows Classic.theme
Which would result in this (as you desired):

Code: Select all

E:\Driver Cache\i386\msxpsinc.ppd
E:\Driver Cache\i386\mxdwdui.ini
E:\Resources\Themes\Luna.theme
E:\Resources\Themes\Windows Classic.theme

joan28
Posts: 12
Joined: 13 Nov 2009 22:16

Re: Copying files

Post by joan28 »

I will try to add something like that in 8.80...
Applause !!!

Definitely "human friendly" version :lol:
Everything is clear and obvious in such case not only for coders.
And with this command XYplorer can be called also a back-up tool.
Maybe adding moving except copying allows to call it also a migrate tool? :D

Just a one question-is a second line in your example ("root=C:\WINDOWS\") really necessary?
It makes obvious plain list a bit (just a bit only) complicated.

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Copying files

Post by j_c_hallgren »

joan28 wrote:Just a one question-is a second line in your example ("root=C:\WINDOWS\") really necessary?
It makes obvious plain list a bit (just a bit only) complicated.
I'd say the reverse is true...is the redundant "C:\WINDOWS\" needed in the list as it's already been specified in the "root" header? I'd find it easier to work with, and also change as needed, when the root source is only listed once.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Copying files

Post by PeterH »

j_c_hallgren wrote:
joan28 wrote:Just a one question-is a second line in your example ("root=C:\WINDOWS\") really necessary?
It makes obvious plain list a bit (just a bit only) complicated.
I'd say the reverse is true...is the redundant "C:\WINDOWS\" needed in the list as it's already been specified in the "root" header? I'd find it easier to work with, and also change as needed, when the root source is only listed once.
For me root= and target= both really make sense.
It should be possible to specify relative pathes in the list - i.e. in the last example:

Code: Select all

Driver Cache\i386\msxpsinc.ppd
...
@j_c: is this what you meant?

And then: maybe generic strings like abc\*.jpg or such?

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Copying files

Post by j_c_hallgren »

PeterH wrote:It should be possible to specify relative pathes in the list - i.e. in the last example:

Code: Select all

Driver Cache\i386\msxpsinc.ppd
...
@j_c: is this what you meant?
Yes, exactly!
And then: maybe generic strings like abc\*.jpg or such?
Agree also with that.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

Post Reply