I'm working on an old 2003 server and I want to copy a folder for specific files while also retaining the folder structure.
Note: I am not allowed to install or add robocopy onto this server.
The command that I use on another server is usually something like this.
robocopy Application Application_small *.txt /E
This, of course, gives me a new directory with nothing but the .txt files and the same folder structure.
But of course, robocopy isn't on Server 2003. However, xcopy does exist. Is there an equivalent switch that I can use to get the same kind of result as robocopy?
Similar question was found here.
xcopy Application\*.txt Application_small /s
Related
The file still exists (because I can open it through powershell) but Remove-Item isn't able to find the location apparently. Do you have any idea why?
Looks like like you hit a similar problem I recently ran into. In my case I had a space at the end of a folder name, and Windows absolutely refused to delete it.
Turns out Windows has an alternate method for addressing files and folders where you have to prefix the path with \\?\.
In your case, probably need to try this:
Remove-Item "\\?\$Profile"
In my case I was working in the command prompt at the time and RD /Q /S "\\?\FilePath" worked. So if worst comes to worst, you might do a Write-Host $Profile, select and copy the resulting path, switch to the command prompt and try the RD /Q /S command.
In your case, what is causing the problem is almost certainly the special characters after the OneDrive\ in the path.
I have a fairly simple robocopy command here that I want to run that will upload files to an Azure storage account. The problem I have is I'm looking at approxiately 70,000 files but a lot of these already exist in the storage account.
What I want to do is run the command in a "Log Only" or "whatif" mode so I can see how many files will be copied and how many will be skipped. This command gives that detail but will perform the copy. Is there a switch I can add that will simply provide the log and NOT copy the files?
S:\inbound\ \\<storageaccount>\<filesharename>\inbound\ /r:3 /w:3 /e /xo /xx /LOG:Robocopy_20200313_Manual.txt
Yes, you may try the switch /L which means List Only but Will Not Copy any files or Change any attributes.
In PowerShell I am trying to copy files from one location to another and want some files to be excluded. so I am using the following commands:
$Excludefiles="`"$((get-content 'C:\WorkingDirectory\List.txt') -join'""')`""
robocopy "C:\aa\" "C:bb\" /XF $Excludefiles
It seems it is excluding everything.
Please share your thoughts.
I'm writing a powershell script for deployment. I need to copy changed files from TFS to our Test Server. I have been able to retrieve the change sets, and I have been able to drill down to the Item. I have access to the path of the source file.
Does anyone know an efficiect way of doing this? Do I need to use the DownloadFile cmdlet or can I just use the Copy-Item cmdlet.
path of sourcefile is $file.ServerItem which resolves to, for example, $/Project/PromonetBaseline/Main/Source/ItemHierarchy.vb
Destination is a path like \\104Server\WebApps\PromonetBaseline\Main\Source\ItemHierarchy.vb
Is there a neat way to do this programatically?
Any input is appreciated.
Thanks,
Akin
For something like this, I would set up a local workfold mapping for the source files, get those files and then use Copy-Item to copy the source files to the destination folder. You can use the -Force parameter on Copy-Item to overwrite an existing file.
Another option is to use tf view itemspec /i > tempfilename to get the files from the server without creating a local workfold mapping.
I got the command in robocopy as mentioned below
ROBOCOPY Source Destination [file…[file]…..] [Options]
Source: Source Directory
Destination: Destination Directory
Files: files to copy .
Please let us know what does the "\server\share\path" means? Kindly provide me an example on this command syntax and explain
An example of a ROBOCOPY call would be
ROBOCOPY C:\Users \\SERVER\backup\Users /MIR /R:0 /W:0
This copys everything under C:\Users to a network share at the UNC path \\SERVER\backup. If you don't know, what that means, google for 'UNC path' or find a nice tutorial that explains how to setup network shares under Windows.
Instead of \\SERVER\backup, that copies to a remote machine, you are totally free to use something like H:\ to copy to a local drive like a USB mass storage device.
The part /MIR /R:0 /W:0 are options of ROBOCOPY. Call ROBOCOPY /? to get an explanation for these.
Cheers,