NewsInternationalLtd
asked on
Filecopying using folder wildcards
I need to copy a 'prefs.js' file down from the netlogon share at user logon, but the folder it needs to go into would seemingly have a random name with a '.default' at the end, eg
C:\Documents and Settings\username\Applicat ion Data\Mozilla\Firefox\Profi les\yhin11 g0.default
How do I copy into this folder? It sounds such an easy problem (and maybe it is) but I've been tearing my hair out trying to do it. The usual wildcards such as * and ? only seem to work for files but not folders, eg, I am unable to use:
Copy "\\DC\NETLOGON\prefs.js" "C:\Documents and Settings\username\Applicat ion Data\Mozilla\Firefox\Profi les\*.defa ult\"
I have also tried this with XCOPY, ROBOCOPY and VBScript to no avail. I've probably missed something obvious but if you can put me out of my misery it would be much appreciated!
Thank you
C:\Documents and Settings\username\Applicat
How do I copy into this folder? It sounds such an easy problem (and maybe it is) but I've been tearing my hair out trying to do it. The usual wildcards such as * and ? only seem to work for files but not folders, eg, I am unable to use:
Copy "\\DC\NETLOGON\prefs.js" "C:\Documents and Settings\username\Applicat
I have also tried this with XCOPY, ROBOCOPY and VBScript to no avail. I've probably missed something obvious but if you can put me out of my misery it would be much appreciated!
Thank you
ASKER
the *.default is a folder though; I need to copy the file below this folder, ie
Copy "\\DC\NETLOGON\prefs.js" "C:\Documents and Settings\username\Applicat ion Data\Mozilla\Firefox\Profi les\<*.def ault>\pref s.js".
Copy "\\DC\NETLOGON\prefs.js" "C:\Documents and Settings\username\Applicat
Try this..
for /f %%a in ('dir *.default /ad /b "%username\Application Data\Mozilla\Firefox\Profi les\"') do copy \\DC\netlogon\prefs.js "%%~dpnxa"
for /f %%a in ('dir *.default /ad /b "%username\Application Data\Mozilla\Firefox\Profi
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
:-)
Thanks, glad to help.
Steve
Steve
ASKER
Sorry, just replying...
Bingo. Good work fella!
I was messing around with FOR /R for a while and getting nowhere.
I have however come accross a small issue. Although this works well when the user is logged on, the variables don't seem to be picked up during login so it fails. I may have a way around this but if you have any ideas then I'm all ears. Thanks again for your help.
Bingo. Good work fella!
I was messing around with FOR /R for a while and getting nowhere.
I have however come accross a small issue. Although this works well when the user is logged on, the variables don't seem to be picked up during login so it fails. I may have a way around this but if you have any ideas then I'm all ears. Thanks again for your help.
ASKER
Sorry, I take that back, I was running the process administratively and it was running as a different user! Thanks again for your help!
No problem ... you can always use a forced path with c:\documents and settings etc. if you want to it as something other than the user..
Steve
Steve
Copy "\\DC\NETLOGON\." "C:\Documents and Settings\username\Applicat