MSFN Forum: Dos 6.22 For - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Dos 6.22 For Rate Topic: -----

#1 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 23 February 2008 - 03:59 AM

Have a need to use For in Dos 6.22 and wondering if someone can tell me how to copy some files.

Heres the situation
I have a folder on the Network called Main and another called Sheets.
As files are updated they are placed in Main for a machine to download. Can be 1 or 20 possibly and None are named the same. I need to copy the identical file from Sheets also.

Yes they are named identical but they go to different folders on the Hard drive like Data1 and data2. One is a machine print and other is for the user.

This will be in a batch file so %% is required. And if a file exists we overwrite

For %%A in (H:\Main\*.*) Do Copy /Y H:\Main\%%A C:\Data1
For %%A in (H:\Main\*.*) Do Copy /Y H:\Sheets\%%A C:\Data2


Does that look correct or someone with Dos skills can help me out here?


#2 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 8,792
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 23 February 2008 - 08:45 AM

Point is, is there a reason why not using xcopy?
http://www.csulb.edu...dock/xcopy.html

jaclaz

#3 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 23 February 2008 - 03:50 PM

I use xcopy now but have to do it by date /D:02/20/2008 to get the Sheets folder files since after I copy from Main they are deleted untill next update which can occur anytime. These are old and don't keep date very well.

Is there a way to use xcopy to get the files that are in main only from Sheets folder also? Sheets is nearly 7500+ files and needs to be done quickly only grabbing Sheets files that are in Main also since they are updated same time.
This is ver 6.2 xcopy in Dos on a whopping 25Mhz with 1mb ram so copy entire folders is sssssllllllllllooooowwow.

This post has been edited by maxXPsoft: 23 February 2008 - 03:53 PM


#4 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 8,792
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 24 February 2008 - 01:09 PM

Well, then, yes, the:
For %%A in (H:\Main\*.*) Do Copy /Y H:\Main\%%A C:\Data1
For %%A in (H:\Main\*.*) Do Copy /Y H:\Sheets\%%A C:\Data2

Should work allright.

jaclaz

#5 User is offline   MHz 

  • SendToA3X v1.7
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,634
  • Joined: 02-August 04

Posted 25 February 2008 - 02:15 AM

It would seem possible to change the 2 loops into just one. I see no sense in using 2 loops with the same loop condition.
For %%A in (H:\Main\*.*) Do (
		Copy /Y H:\Main\%%A C:\Data1\
		Copy /Y H:\Sheets\%%A C:\Data2\
)


#6 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 8,792
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 25 February 2008 - 04:01 AM

Yep, but if, for any reason, H:\Main and H:\Sheets are "far apart" physically on the drive, the seeking back and forth may be increased. :unsure:

I would test both solutions with the same set of files and see if there is a noticeable difference in speed, the hardware specs appear to be extremely low.

jaclaz

#7 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 25 February 2008 - 07:20 AM

I didn't put all the Paths there and its only a 10 Mhz. :wacko: We only have 5 left.

Couldn't use above because For %%A in (H:\Main\*.*) turns into the Full path for the variable so that fails.

so Had to use this

H:
CD SHOPMFG
CD SECOND~1
CD COOPER~1
CD NUMBER06
For %%A in (*.*) Do Copy H:\SHOPMFG\SECOND~1\COOPER~1\Sheets\%%A C:\2WND\DATA_2 /Y
By CD to actual dir the variable %%A becomes filename only and these are 8.3 names

MHz,
I'll look at using that because I actually need to do 3 operations here.
Copy the Number## file to Data_1
Copy corresponding Sheets file to Data_2
Delete the Number## file so next time there are less. Bad here is while its still on H: it creates a funky file AHEIVOP or similar but that may have been Xcopy I was using on that folder.

By CD.. all the way back to C: that don't happen. Also need the path to be back to C: for load of next 2 programs anyways and need H: to be at root.

This post has been edited by maxXPsoft: 25 February 2008 - 07:25 AM


#8 User is offline   MHz 

  • SendToA3X v1.7
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,634
  • Joined: 02-August 04

Posted 25 February 2008 - 08:26 AM

@jaclaz
Yeah, I agree that seek times could be a problem under certain conditions. And probably being a FAT filesystem could hinder performance some. For NTFS, seeking is affected by having to read the MFT each time and returning to the location of where the file is, so seek maybe not much of a performance hit.

@maxXPsoft
I am not sure how much you can do with DOS 6.22 since long ago that I used. But you do have some other options available with switches to enhance the usage of CD or other commands. And if long filename support is available then using quotes may help.
An example of using the /D switch with CD allows you to change the current working directory to another drive.
@echo off
CD /D "D:\"
For %%A in ("*.*") Do (
		Echo Main gets "D:\%%A"
		Echo Sheets gets "D:\%%A"
)
CD /D "C:\"
For %%A in ("*.*") Do (
		Echo Main gets "C:\%%A"
		Echo Sheets gets "C:\%%A"
)
pause

You may even look at using PushD and PopD if suitable.

And this may work for you though I am getting some what lost with understanding your paths now.
CD /D "H:\SHOPMFG\SECOND~1\COOPER~1"
For %%A in ("Main\*.*") Do (
		Copy /Y "Main\%%A" "C:\Data1\"
		Copy /Y "Sheets\%%A" "C:\Data2\"
)
CD /D "C:\"

This post has been edited by MHz: 25 February 2008 - 08:29 AM


#9 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 8,792
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 25 February 2008 - 09:11 AM

The above makes me wonder...:)

...you could use SUBST:
http://www.computerh...om/substhlp.htm

to map the \Main and the \Sheets to a "plain" drive letter.

jaclaz

#10 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 25 February 2008 - 10:13 PM

Found the best thing - Fortune.exe part of fortn708 package.
Its a tuner for the Dos For command and works great.
fortune in H:\ShopMfg\Second~1\cooper~1\number01\*.* Do Copy H:\ShopMfg\Second~1\cooper~1\Sheets\%R.%E C:\2Wnd\Data_2

by running that I get a batch file with all commands and it even deletes the doit.bat at end of execution.
The %R.%E extracts just filename and you can do all kinds of things with it. I can run that from C: drive without any hitch.

Those Paths aren't mine, :no: it where I work and the guy before me should have made it short path knowing he had Dos machines out there.

#11 User is offline   maxXPsoft 

  • MSFN Master
  • Group: Developers
  • Posts: 2,482
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 26 February 2008 - 01:51 AM

spoke too soon. can't get that forune.exe to run inside a batch so back to other method
Can't use with this dos (
)
Can't use CD with the /D either

H:
CD SHOPMFG\SECOND~1\COOPER~1\NUMBER01
For %%A in (*.*) Do Copy H:\SHOPMFG\SECOND~1\COOPER~1\Sheets\%%A C:\2WND\DATA_2 /Y
CD H:\   <<< puts it back to root. CD H: just echos your current dir
C:

Check out what I am doing with the CD here, it works so I'll use it. Some day they'll update these things but that was put on back burner to do other stuff.

#12 User is offline   MHz 

  • SendToA3X v1.7
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,634
  • Joined: 02-August 04

Posted 27 February 2008 - 11:53 AM

View PostmaxXPsoft, on Feb 26 2008, 05:51 PM, said:

Can't use with this dos (
)
Can't use CD with the /D either

I thought there maybe some limitations in that environment. Just do a 2nd For loop for the "Main" folder if needed. Your last attempt looks like you are on track. ;)

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy