WAY OT batch file command

The file backup utility in our sales program has crashed and burned.

I need to make a batch file that I can just have the operator click on the icon and run it. One command I need help with is a MD command having a unique name for each date. Any format for date would be fine. The file would go something like this

CD\SALES MD COPY C:\SALES\*.DBF COPY C:\SALES\*.CDX

I know this is totally way off topic. Almost as bad as discussing politics. Metal content: The SO put her foot down, I can't start welding on the next project until this is fixed. We have a scraper, dozer and trackhoe here building the pad for the new machine shop. Need a custom metal grate for the highway culvert right now.

Karl

Reply to
Karl Townsend
Loading thread data ...

...

[snip]

...

Works for me :)

...

...

Under W2000, date outputs as (eg) "Sat 09/03/2005", so perhaps that's different from yours. A command file I tested: set v=%date:~10,4%.%date:~4,2%.%date:~7,2% echo %v% mkdir "%v%" cd "%v%" copy ..\*.bat . dir/w cd .. produces directory names like "2005.09.03". That is, a flat set of directories rather than your tree form,

2005\09\03

Karl -

formatting link
has some examples near the middle of the :~ op.

-jiw

Reply to
James Waldby

Chris wrote: ...

I realize FAT16 has a limit of 512 entries per folder but other filesystems have higher limits, eg FAT32- 65,534 files or folders per folder, per

formatting link
formatting link
"The previous limitations on the number of root folder entries no longer exist." :) Meanwhile,
formatting link
complains about slow directory access with 57000 files in a directory.

All that aside, I think it is reasonable to have at least a year-based tree structure, and if the daily backups are pretty big, break it down by months also to closer match CDR or DVD-R size.

-jiw

Reply to
James Waldby

WAY KEWL

Thanks for the help. I never cease to be amazed at the breadth of knowledge available in this NG

Karl

Reply to
Karl Townsend

I prefer to run a Quickbasic program that dynamically generates the batch script then shells out and runs it. I have a QB program that runs every night on my backup server that does the following:

Creates a subdirectory on drive D: (which is hot- swap raid 1) of the form yymmdd

Copies the network server over completely to the subdirectory using xxcopy and the copy everthing option.

Creates a subdirectory inside that subdirectory called \website

Generates and runs an ftp script that copies over a tarball backup from my internet server that it created the day before onto that subdirectory.

Since my backup server has 300 gig drives and the network server is only about 3.5 gig, the backup server keeps about 80 days worth of backup images. I go through and prune them down to weekly every once in a while.

Every friday night, I break the raid mirror, pull one of the backup drives and stick it in my car. I put in the drive that was in my car and resync the mirror. No reboots no hassle. I spend about

10 minutes a week doing backups.
Reply to
Jim Stewart

All good points, but two things. One NTFS has a limit of 512 entries in the root directory, to which the OP was creating the directories. Secondly the OP did not mention the if he was using NTFS or FAT so the lest common denominator was chosen.

Reply to
Chris

"Karl Townsend" wrote in message news:4319cfca$0$79993$ snipped-for-privacy@auth.newsreader.octanews.com...

Karl,

Not sure of which version of Microsoft you are using. Might need to specify as the commands vary somewhat.

md %date:~-4,4%\%date:~-10,2%\%date:~-7,2%

This is a neat trick off the top of my head. It creates a tree of directories (ie. year, than the month then the day), making it a little easier to navigate. Should work fine for you. I found this years ago and it works great. Use it in a couple of places.

CD %date:~-4,4%\%date:~-10,2%\%date:~-7,2%

Would work as well.

Reply to
Chris

"Karl Townsend" wrote in message news:4319cfca$0$79993$ snipped-for-privacy@auth.newsreader.octanews.com...

Karl, OK got bored here :

xcopy c:\sales\*.dbf c:\%date:~-4,4%\%date:~-10,2%\%date:~-7,2% /I /Y /C /V xcopy c:\sales\*.cdx c:\%date:~-4,4%\%date:~-10,2%\%date:~-7,2% /I /Y /C /V

The two commands above should get you going. Tried to get them into one command but windows will not allow you to call out more than one filename from the source, at least that I know of.

Those should do it for you. As a sidenote you really should be using the xcopy command for this. "xcopy /?" and any command prompt will get you the info needed. Lot more powerful for what you are doing.

Reply to
Chris

The tree form was just a goof actually. If I remember right, I did not bother converting the "/" out of the .bat file. Tried, but than I figured that the directory tree was actually a little neater. Even more so if he is just wanting to start the directory structure off the root of the drive. Remember only 512 directory entries allowed. So 1.4 (or so) years from now he would be in trouble and might not know it.

Reply to
Chris

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.