Jump to content











Photo
- - - - -

help: copy file to folder


  • Please log in to reply
3 replies to this topic

#1 oneclicklogin

oneclicklogin
  • Members
  • 3 posts
  •  
    Japan

Posted 14 November 2013 - 09:13 AM

everyday, i received many fixed .xls file. EX: abc mmm.xls, hhh klm.xls. lkj hgf.xls. I put all in a folder, ex:C:\dailymail.

i have many fixed folder with special name,.EX: mmm,klm,hgf...(a part of filename i received).

everyday, i have to copy manual many file to many folder. EX: C:\dailymail\abc mmm.xls into mmm, C:\dailymail\hhh klm.xls into klm...

can you help me do it automatically.

Thanks so much.

(My English is not good)

 

filename contain folder name. eg:

folder i received many file. eg C:\daily mail

file name:

data bush obama xxx.xls

mail la ny xyz.xls

...

target folder .eg "D:\data mail" have many folder

bush obama

la ny

...

i have to copy file "C:\daily mai\data bush obama xxx.xls" to folder "D:\data mail\bush obama"

 

i have to copy file "C:\daily mai\mail la ny xyz.xls" to folder "D:\data mail\la ny"

 

note:

xxx, xyz: random string

 

thanks.


Edited by oneclicklogin, 14 November 2013 - 09:14 AM.


#2 oneclicklogin

oneclicklogin
  • Members
  • 3 posts
  •  
    Japan

Posted 19 November 2013 - 01:53 AM

Can you help me? please.

#3 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 21 November 2013 - 12:45 AM

Well, it is certainly is not the right place to put a request like this...that is probably why no one answered.  It is mainly for scripts written in the winbuilder tool to automate building boot disk environments.

 

BUT,  In general, you want to make some sort of a script (with variables) and some basic tools like "pattern recognition"  For example you could create a basic BAT file that takes inputs for the parts that matter...like above where you have "Bush Obama" and use wild cards or other patterns to get the other files...

 

Since the same thing is used for both a part of the file name and the directory, something like this (inside a bat file)

 

     copy "C:\daily mai\data%1*.*"   "D:\data mail\%1\*.*"

 

might be a way to do this...if this was called "my_copy.bat", you could say

   > mycopy "bush obama"

 

to do the copy of the files to the folder. There are many sites on the web for places to learn more about dos scripts and variables.  You should look at them and also get some basic programming help.  Note: the above is just an example of how it can be done.   You would want to add a lot more to the script so that it would create the directory if it didn't exist, and do other error trapping, etc.  But that is the basics.

 

A quick "google" of "dos script to copy variable file names" gave a lot of good links.  For example, this one

http://stackoverflow...lename-elements that even shows a complex parsing of the file names based on parsing the file names.

 

Stackoverflow is a good place to search and poke around to find more help on something like this.

 

Good Luck!

 

:cheers:

Scott


  • oneclicklogin likes this

#4 oneclicklogin

oneclicklogin
  • Members
  • 3 posts
  •  
    Japan

Posted 21 November 2013 - 02:58 AM

thanks.

update image.

 

<a href="http://www.freewebproxy.com/"><img src="http://www.freeimagehosting.net/newuploads/i96lg.jpg" alt="Free Web Proxy"></a>

 

copy.jpg

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users