How can I copy file from Windows to Ubuntu?

Windows Server: Copy today's file using batch file?

  • hi all   i am having 'n' number of file, i want to copy only todays file based on date modification.

  • Answer:

    SET CurrentDate=%date:~-7,2%-%date:~-10,2%-%date:~-4,4% xcopy C:\folder\*.* C:\otherfolder\*.* /d:%CurrentDate% Try the above in a batch file replacing C:\folder and C:\otherfolder\ with your source and destination folders. xcopy allows the /D switch which copies files changed on or after the specified date. eg. xcopy source destination /D:m-d-y Specifying the date your self would work and you need run the command xcopy source destination /D:08-09-2013 for files dates September 8th. But for a more automated method a little date manipulation is required.   The problem with xcopy /D on its own is the date format accepted for the /D switch is m-d-y and windows displays the date as mm/dd/yyyy. The first line is therefore manipulating the date into the required order with dashes instead of slashes and setting it into the variable CurrentDate, which is what were then providing into the /D switch.

Farooq Rauf at Quora Visit the source

Was this solution helpful to you?

Other answers

PowerShell makes it easier.  You can define today at "since 00;00 midnight" or "within the last 24 hours." # start at midnight [datetime]$today = Get-Date -f 'MM/dd/yyyy' # or last 24 hours [datetime]$today = ( Get-Date ) - ( New-TimeSpan -day 1 ) Get-ChildItem -Path | Where-Object { $_.LastWriteTime -gt $today } | Copy-Item -Destination $dest

Tim Dunn

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.