Question how to copy date wise file

p_dutta06

Commendable
Mar 9, 2017
7
0
1,510
sir
I have a linux server that has database backup in daily basis date wise. I am willing to copy this backup file from a win 10 pc using batch file .
Example---- in Linux server backup type 8042019.dmp and next day it will be 9042019.dmp..so on ..
how i will copy it from win10 client using batch file. I tried command pscp -pw <password> -r -P <port> username@IP address:/path/to/file/*.dmp c:\test\ with batch file. it copied file but cannot copy daily basis on schedule...pls help
 
use windows built in Task Scheduler to run it on a daily basis. I use this bat file to get the latest log files generated during install at the end of the install run to copy the latest files in the TEMP directory, maybe you can modify it.

This would probably require you to mount/map the linux volume to your windows client, then you would pushd your_directory (in my case, i need files from the user's TEMP dir, hence I push the %temp%). Something like this perhaps if you mapped it to E:\LinuxDatabase directory. I can't guarantee it will run but you can get the idea and play with it. posting the version i use would be of no use

Code:
pushd E:\LinuxDatabase\

for /f %%i in ('dir *.dmp /b/a-d/od/t:c') do set LAST=%%i
rem echo The most recently created file is %LAST%
xcopy /y /q %LAST% C:\test\"

popd
 
Last edited by a moderator:
use windows built in Task Scheduler to run it on a daily basis. I use this bat file to get the latest log files generated during install at the end of the install run to copy the latest files in the TEMP directory, maybe you can modify it.

This would probably require you to mount/map the linux volume to your windows client, then you would pushd your_directory (in my case, i need files from the user's TEMP dir, hence I push the %temp%). Something like this perhaps if you mapped it to E:\LinuxDatabase directory. I can't guarantee it will run but you can get the idea and play with it. posting the version i use would be of no use

Code:
pushd E:\LinuxDatabase\

for /f %%i in ('dir *.dmp /b/a-d/od/t:c') do set LAST=%%i
rem echo The most recently created file is %LAST%
xcopy /y /q %LAST% C:\test\"

popd

Thank you for reply ....