Forum Home
Press F1
 
Thread ID: 43819 2004-03-28 02:03:00 Batch file hlep please John W (523) Press F1
Post ID Timestamp Content User
225560 2004-03-28 02:03:00 Im wanting to write a batch file to transfer files from 1 PC to another. Ive got that part sorted, you see the files Ive transferred in the past were all in easy named folders direct off C drive with short names, like 1cmr, or folders with names equal to or less than 8 characters long, no spaces or untoward characters (DOS never stood for that sort of nonsence).

Now my problem is, with Win XP, the files I want to transfer are nested in this location C:\Program Files\Hana-tech\data Im not sure how to go about writing this in a batch file. Do I use the full name with spaces & the - key as well?

In this Data folder there are subfolders (which I dont want) as well as the Data files I need. How do I get the batch file to give me the data files but not the folders?

Examples if you could please. Im sure I can work out the rest.

Thanks awfully your humble scribe

John in Mosgiel
John W (523)
225561 2004-03-28 02:20:00 The first part of your question is answered by using double-quotes around the directory names which contain spaces. (If you don't want to use the short directory name std.

e.g. C:\"Program Files"\Hana-tech\data

or C:\"Program Files\Hana-tech\data"\ if you just want to quote the whole lot


or C:\progra~1\hana-t~1\data using short names


I'll have To get back on the second part of your query

Cheers, Babe.
Babe Ruth (416)
225562 2004-03-28 02:23:00 C:\Progra~1\Hana-t~1\data.
I'm pretty sure the ~ key is the correct one.
mikebartnz (21)
225563 2004-03-28 02:33:00 Sometimes I do a quick copy/backup of one HDD to another by using:

xcopy "c:\*.*" "d:\backup\*.*" /y/e/s/h/r/c/k

This copies everything on C: including all hidden and system files and all folders and subfolders and also keeps any long file names of files.

So you could use somthing like:

xcopy "c:\program files\hana-tech\data\*.*" "enter the path to 2nd pc here"

Don't put any of the /y/e/s/h/r/c/k on the end as this will copy the folders which you don't want :)
Note the placement of the ""
CYaBro (73)
225564 2004-03-28 02:55:00 If running under XP "DOS" prompt, then no system file transfer can be guaranteed as many are in use. DOS under XP is actually a DOS emulator in Windows.

There is no need for any "" in the command xcopy "c:\*.*" "d:\backup\*.*" as all command parameters are within the 8.3 syntax (even if the resulting files transferred are not). Nothing is lost in using the "" however.

I use:
xcopy c:\data\*.* e:\data\*.* /y/d/s

This transfers all files under the c:\data folder and subfolders, on an incremental basis (only changed files are copied). e:\ is a removeable HDD. Backup is done daily (takes only seconds).

As I have just (almost) lost another main HDD (makes 4 in 3 years, across several different PCs) its worthwhile.
godfather (25)
1