getting Date modified into a string
Posted: 17 Sep 2009 00:41
Hey,
i'm trying to copy txt-files as backup into a zip-file. So far, so good...
The problem is that this bat-file is activated by several persons trough the all day, because its possible that some person changes the original txt-file. To keep a log in my backup-zip of all versions i was thinking to copy all txt-files in an temporary folder with in the new file-name the date that this file has been modified, so that i don't lose any version.
By the command ECHO i can get the date modified, but now i need to put this in a string to rename my original file when i copy this before zipping all files.
The echo-command:
FOR %%? IN (C:\Biblio_sql\Biblio_sql\*) DO (
ECHO File Name Only : %%~n?
ECHO File Extension : %%~x?
ECHO Name in 8.3 notation : %%~sn?
ECHO File Attributes : %%~a?
ECHO Located on Drive : %%~d?
ECHO File Size : %%~z?
ECHO Last-Modified Date : %%~t?
ECHO Parent Folder : %%~dp?
ECHO Fully Qualified Path : %%~f?
ECHO FQP in 8.3 notation : %%~sf?
ECHO Location in the PATH : %%~dp$PATH:?
)
What i'm trying to do :
COPY C:\Biblio_sql\Biblio_sql\* C:\Biblio_sql\Work_Folder\*~t?%.txt (but nothing here works...)
zip C:\Biblio_sql\Archive_sql.zip C:\Biblio_sql\Work_Folder\*.txt
ECHO erase C:\Biblio_sql\Work_Folder\*.txt
Thx a lot!!!
i'm trying to copy txt-files as backup into a zip-file. So far, so good...
The problem is that this bat-file is activated by several persons trough the all day, because its possible that some person changes the original txt-file. To keep a log in my backup-zip of all versions i was thinking to copy all txt-files in an temporary folder with in the new file-name the date that this file has been modified, so that i don't lose any version.
By the command ECHO i can get the date modified, but now i need to put this in a string to rename my original file when i copy this before zipping all files.
The echo-command:
FOR %%? IN (C:\Biblio_sql\Biblio_sql\*) DO (
ECHO File Name Only : %%~n?
ECHO File Extension : %%~x?
ECHO Name in 8.3 notation : %%~sn?
ECHO File Attributes : %%~a?
ECHO Located on Drive : %%~d?
ECHO File Size : %%~z?
ECHO Last-Modified Date : %%~t?
ECHO Parent Folder : %%~dp?
ECHO Fully Qualified Path : %%~f?
ECHO FQP in 8.3 notation : %%~sf?
ECHO Location in the PATH : %%~dp$PATH:?
)
What i'm trying to do :
COPY C:\Biblio_sql\Biblio_sql\* C:\Biblio_sql\Work_Folder\*~t?%.txt (but nothing here works...)
zip C:\Biblio_sql\Archive_sql.zip C:\Biblio_sql\Work_Folder\*.txt
ECHO erase C:\Biblio_sql\Work_Folder\*.txt
Thx a lot!!!