| View previous topic :: View next topic |
| Author |
Message |
Tdk161 Valued Contributor


Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Thu Oct 07, 2010 7:15 pm Post subject: Copy Files,SubFolder,Folder [SOLVED] |
|
|
Hi guyz,
I'm trying to copy entire folder structure/files
Anyone can tell me if exists some procedure to make it?
Many tnx in advance for any info
Byez
Last edited by Tdk161 on Tue Oct 12, 2010 10:56 am; edited 1 time in total |
|
| Back to top |
|
 |
bornsoft Contributor

Joined: 19 Feb 2009 Posts: 113 Location: Germany
|
Posted: Fri Oct 08, 2010 12:40 am Post subject: |
|
|
The simplest way would be using "xcopy".
Run a command window and type "help xcopy" to get informations about the commandline switches.
From within VDS call xcopy like this:
| Code: |
runh @windir(s)\cmd /c xcopy /k /r /e /i /s /c /h <source> <destination>,wait
|
I hope this helps
bornsoft
. |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Fri Oct 08, 2010 3:12 am Post subject: |
|
|
Of course you can also do it all from VDS with out making any command line calls or anything like that.
An API call to get the list of folders and files in the branch of the tree you want and then loop the list creating the folders in the new location and copy the files. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
GregLand Valued Contributor


Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Fri Oct 08, 2010 8:54 am Post subject: |
|
|
Hello !
It's possible to use file copy to copy structure directory :
| Code: | file copy,"folder_source","folder_destination"
|
|
|
| Back to top |
|
 |
Tdk161 Valued Contributor


Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Mon Oct 11, 2010 9:53 pm Post subject: |
|
|
GregLand
thank you sorry but not work, maybe I wronged command syntax
I used "File Copy,c:\arc,d:\Bkp"
I think command File Copy can work only with files
GregLand
thank you but I would like not use external executable, if possible, only Vds script.
Cheers  |
|
| Back to top |
|
 |
GregLand Valued Contributor


Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Tue Oct 12, 2010 1:32 am Post subject: |
|
|
Strange, it work for me using this script to make mirror directory...
| Code: | | File Copy,"c:\arc","d:\Bkp" |
|
|
| Back to top |
|
 |
Tdk161 Valued Contributor


Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Tue Oct 12, 2010 10:51 am Post subject: |
|
|
Hi Gregland
I retryed the command you suggested to me and now work
I don't know why but now work fine, I wronged somthing
Many tnx for your help
Cheers |
|
| Back to top |
|
 |
uvedese Contributor


Joined: 21 Jan 2006 Posts: 169 Location: Spain
|
Posted: Tue Oct 12, 2010 2:45 pm Post subject: |
|
|
Hi again Tdk161
If you don't use "filecopy" command to copy an entire folder you can use this routine (much slower but effective):
| Code: | %%orig = "your origin path F.E.: c:\drivers"
%%dest = "your destination path F.E.: d:\"
%%mylist = @new(list,sorted)
list filelist,%%mylist,%%orig\*.*,A
list filelist,%%mylist,%%orig\*.*,D
list filelist,%%mylist,%%orig\*.*,H
%i = 0
repeat
%a = @item(%%mylist,%i)
if %a
list filelist,%%mylist,%a\*.*,A
list filelist,%%mylist,%a\*.*,D
list filelist,%%mylist,%a\*.*,H
%i = @succ(%i)
end
until @null(%a)@greater(%i,@count(%%mylist))
if @greater(@count(%%mylist),0)
list seek,%%mylist,0
end
repeat
%a = @next(%%mylist)
if %a
%1 = @substr(@path(%a),4,-1)
if @not(@file(%%dest%1,D))
directory create,%%dest\%1
end
if @file(%a,A)
file copy,%a,%%dest%1
end
end
until @null(%a)
info All files are copied! |
Good luck!
Cheers
__________
uVeDeSe
__________ |
|
| Back to top |
|
 |
Tdk161 Valued Contributor


Joined: 08 Feb 2005 Posts: 399 Location: ITALY
|
Posted: Wed Oct 13, 2010 1:22 am Post subject: |
|
|
HI Uvedese
I solved using your code
I little bit modified your script:
Now can:
- recreate orgin folder name or not into destination folder (without all origin folder path)
- filter files to copy by extension
| Code: | %%oFolder =
%%Ext_ = *
%%orig = "C:\Documents and Settings\Administrator\Documenti\Visual DialogScript Projects\Panacea"
%%dest = "C:\Documents and Settings\Administrator\Desktop\passa"
%%mylist = @new(list,sorted)
list filelist,%%mylist,%%orig\*.%%Ext_,A
list filelist,%%mylist,%%orig\*.*,D
list filelist,%%mylist,%%orig\*.%%Ext_,H
%i = 0
repeat
%a = @item(%%mylist,%i)
if %a
list filelist,%%mylist,%a\*.%%Ext_,A
list filelist,%%mylist,%a\*.*,D
list filelist,%%mylist,%a\*.%%Ext_,H
%i = @succ(%i)
end
until @null(%a)@greater(%i,@count(%%mylist))
if @greater(@count(%%mylist),0)
list seek,%%mylist,0
end
repeat
%a = @next(%%mylist)
if %a
If %%oFolder
%1 = @StrRep(%a,@Path(%%Orig),%%Dest\)
Else
%1 = @StrRep(%a,%%Orig,%%Dest\)
End
if @file(%a,D)
directory create,%1
End
if @file(%a,A)
file copy,%a,%1
end
end
until @null(%a)
Stop
|
Many many Thank
Cheers |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|