Replace command
Moderator: DosItHelp
-
- Posts: 5
- Joined: 07 Jun 2012 18:53
Replace command
====================================================================================
:: UPDATE.bat
:: Updates the Chosen Directory with the Latest Files
::
@ECHO OFF
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\"*.* "C:\distributionpt" /A
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\"*.* "C:\distributionpt" /U
:END
====================================================================================
Can anyone tell me if im doing something wrong cause the new files are not being copied or replaced by new ones..
:: UPDATE.bat
:: Updates the Chosen Directory with the Latest Files
::
@ECHO OFF
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\"*.* "C:\distributionpt" /A
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\"*.* "C:\distributionpt" /U
:END
====================================================================================
Can anyone tell me if im doing something wrong cause the new files are not being copied or replaced by new ones..
Re: Replace command
look at the differance in red & green:
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\"*.* "C:\distributionpt" /A
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\"*.* "C:\distributionpt" /U
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\*.*" "C:\distributionpt" /A
REPLACE "C:\Documents and Settings\NGWC\Desktop\distributionpt\*.*" "C:\distributionpt" /U
-
- Posts: 5
- Joined: 07 Jun 2012 18:53
Re: Replace command
Its still not working... what im trying to do is to to keep a folder of Internet explorer favorites updated, so when someone updates/adds new favourites (most probably on a server ), it will be updated in the folder (on the running pc) too.
Re: Replace command
I tried the code and it work with no errors at all,i tested with two folders 1 and 2 on the desktop and here is the code:"from cmd window and from a batch file"
the result
try using to avoid spaces in documents and settings
and why using switch /U too use /A or /U and i suggest /A
Code: Select all
C:\Users\Admin\Desktop>replace "%cd%\1\*.*" "%cd%\2" /A
the result
Code: Select all
Adding C:\Users\Admin\Desktop\2\file_1.txt
Adding C:\Users\Admin\Desktop\2\file_2.txt
try using to avoid spaces in documents and settings
REPLACE "%userprofile%\Desktop\distributionpt\*.*" "C:\distributionpt" /A
and why using switch /U too use /A or /U and i suggest /A
Re: Replace command
Sorry,
u are right the files when i modify it it dosn't updated in the destination folder so use
/U /S switchs together it will update the new or modefied files only.and don't use the /A switch it should be like that:
u are right the files when i modify it it dosn't updated in the destination folder so use
/U /S switchs together it will update the new or modefied files only.and don't use the /A switch it should be like that:
REPLACE "%userprofile%\Desktop\distributionpt\*.*" "C:\distributionpt" /U /S
-
- Posts: 5
- Joined: 07 Jun 2012 18:53
Re: Replace command
the /A switch will add files new files which are not in the destination folder.
the /U /S switch will update files which are already in the folder but updated...
the thing is, what if i have an whole subfolder in that folder itself? it never copied the folder over...
the /U /S switch will update files which are already in the folder but updated...
the thing is, what if i have an whole subfolder in that folder itself? it never copied the folder over...
Re: Replace command
You might find that Robocopy is better to mirror a folder of shortcuts, if that is what you want to do. It will copy new ones and changed ones and delete ones that have been removed.
-
- Posts: 5
- Joined: 07 Jun 2012 18:53
Re: Replace command
Im sort of backing up the files, not really just shortcuts. it can be documents etc.
robocopy command doesnt seem to be working on my cmd
robocopy command doesnt seem to be working on my cmd
Re: Replace command
Robocopy is a good tool for that.
It's standard in Vista and Windows 7 and can be downloaded for XP from Microsoft.
It's standard in Vista and Windows 7 and can be downloaded for XP from Microsoft.
Re: Replace command
then u should use the copy command, it is a bookmarks so if new one exist it will be copied if old one will be re-copied and if one deleted the user should then choose by himself wether to remove the bookmark or not the main idea which u explained is giving every one all the bookmark if there is new
-
- Posts: 5
- Joined: 07 Jun 2012 18:53
Re: Replace command
ok.. im using robocopy.. it does what i want.. but the problem now is.. can it run as a .bat file? cause when i paste in the code in cmd, it works, but when i use as .bat it doesnt...
=============
@echo off
robocopy "C:\Documents and Settings\NGWC\Desktop\RoboTest" "\\192.168.50.1\train-mode\RoboTest" /MIR /Z
=============
=============
@echo off
robocopy "C:\Documents and Settings\NGWC\Desktop\RoboTest" "\\192.168.50.1\train-mode\RoboTest" /MIR /Z
=============
Re: Replace command
Put this as the last line and see what error message is on the screen.
pause
pause