Computing.Net > Forums > Disk Operating System > Copying the most recent file from one directory to another

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Copying the most recent file from one directory to another

Reply to Message Icon

Name: louie gomez
Date: February 13, 2001 at 06:35:50 Pacific
Comment:

Supposing I have some backup files in a directory that look like this:
>
> Northwind_db_200102012100.bak
> Northwind_db_200102022100.bak
> Northwind_db_200102032100.bak
> Northwind_db_200102042100.bak
> Northwind_db_200102052100.bak
> Northwind_db_200102062100.bak
> Northwind_db_200102072100.bak
> Northwind_db_200102082100.bak
>
> How would I be able to pull the most current file (in this case:
> Northwind_db_200102082100.bak) and move it to another directory?? Is it
> possible to use the dos DIR command for this scenario?
>
> Thanks,
> Louie



Sponsored Link
Ads by Google

Response Number 1
Name: Laurence
Date: February 14, 2001 at 13:08:23 Pacific
Reply:

:: mvnewest.bat
@ECHO off
for %%f in (*.bak) do set new=%%f
move /y %new% newdir
::

Batfiles: The DOS batch file programming handbook



0

Response Number 2
Name: Louie
Date: February 14, 2001 at 13:29:40 Pacific
Reply:

Thank you very much. I will give it a try.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Running a DOS program in ... works 2.0



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Copying the most recent file from one directory to another

Copying folders from one directory to another www.computing.net/answers/dos/copying-folders-from-one-directory-to-another/16955.html

copy files from 1 server to another www.computing.net/answers/dos/copy-files-from-1-server-to-another/13482.html

moving a folder from one disk to another www.computing.net/answers/dos/moving-a-folder-from-one-disk-to-another/11192.html