forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Copy Files,SubFolder,Folder [SOLVED]

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Thu Oct 07, 2010 7:15 pm    Post subject: Copy Files,SubFolder,Folder [SOLVED] Reply with quote

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
View user's profile Send private message Send e-mail
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Fri Oct 08, 2010 12:40 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Fri Oct 08, 2010 3:12 am    Post subject: Reply with quote

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
View user's profile Send private message
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Fri Oct 08, 2010 8:54 am    Post subject: Reply with quote

Hello !
It's possible to use file copy to copy structure directory :
Code:
file copy,"folder_source","folder_destination"
Back to top
View user's profile Send private message Visit poster's website
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Mon Oct 11, 2010 9:53 pm    Post subject: Reply with quote

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 Rolling Eyes
Back to top
View user's profile Send private message Send e-mail
GregLand
Valued Contributor
Valued Contributor


Joined: 15 Jun 2004
Posts: 212
Location: FRANCE

PostPosted: Tue Oct 12, 2010 1:32 am    Post subject: Reply with quote

Strange, it work for me using this script to make mirror directory... Shocked
Code:
File Copy,"c:\arc","d:\Bkp"
Back to top
View user's profile Send private message Visit poster's website
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Tue Oct 12, 2010 10:51 am    Post subject: Reply with quote

Hi Gregland Very Happy

I retryed the command you suggested to me and now work Very Happy
I don't know why but now work fine, I wronged somthing Stupid

Many tnx for your help
Cheers
Back to top
View user's profile Send private message Send e-mail
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Tue Oct 12, 2010 2:45 pm    Post subject: Reply with quote

Hi again Tdk161 Very Happy

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
View user's profile Send private message Visit poster's website
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Wed Oct 13, 2010 1:22 am    Post subject: Reply with quote

HI Uvedese Smile

I solved using your code Thumbs Up
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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group