Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I need to get folder names in my server, as you know when you start cmd.exe it has default path name like "C:\Documents and ....". I can get folder names which are in my "C:/" by typing dir *.* /b /o:n > index.txt.
so I have this;
C:\Documents and Settings\Name>dir *.* /b /o:n > index.txt
I need this if there is a way;
\\Server\Volume\File>dir *.* /b /o:n > index.txt
sorry for my broken english, any help wellcome.
Use:
pushd \\Server\Volume
dir
popd
You could map the drive and then browse that directory:
net use Z: \\Server\Volume
cd /d Z:\
dir
Hope this helps :)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
How would I alter this code to make it non-recursive?
FOR /R %pathold% %%G in (*.tif *.tiff *.jpg *.jpeg *.pdf) do (
move "%%G" %pathnew%>NUL
echo %%G
)
I tried using ForFiles, but it doesn't support multiple Wildcards.
ForFiles /P %pathold% /M *.tif *.tiff *.jpg *.jpeg *.pdf /C "move #path %pathnew%"
ERROR: Invalid argument / option - '* .tiff'.
So in order to use only the root Directory remove the /R %pathold% from the Code above so it looks like this:
FOR %%G in (*.tif *.tiff *.jpg *.jpeg *.pdf) do (
move "%%G" %pathnew%>NUL
echo Moving %%G
)
Important to note:
You have to be in the Directory you wan't to move from.
You can do this with cd %oldpath% or pushd %oldpath% for example.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I think this should be rather simple but I want to delete all the files that are stated in for example: C:\TEST but I want to leave the files that are located in subdirectories of this folder. For example files in the folder: C:\TEST\Backup should not be deleted.
When using the following batch command all the files get deleted including those located in sub directories but it leaves the folder:
DEL /S C:\TEST\ /q
Does anyone know the command that I need?
It is as simple as this:
from cmdline:
for %a IN (C:\TEST\*.*) do echo "%a"
OR In a batch script, just add an additional %
for %%a IN (C:\TEST\*.*) do echo "%%a"
Just replace echo with del once you are confident with your final script.
OR simply doing:
del C:\TEST /q
All these things can be found by simply opening cmd.exe and running ANY of the commands with the /? switch. For instance.
for /?
del /?
etc.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In the end, I want to copy the last modified folder in a directory. In order to do this, I need to pass in the name of the last modified folder to xcopy.
How do you find the last modified folder, not file, in a directory with command prompt? I have found many scripts that will find the last modified file, but I cannot seem to find a command that will find the last modified folder.
Any help would be appreciated.
#echo off
for /f "delims=" %%a in (' dir /ad /od /b ') do set "folder=%%a"
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
In Dos if you type
copy c:\a.txt
it will copy a.txt* (a.txt1, a.txtb, etc)
how can I just copy a.txt?
Your question is not correct - copy c:\a.txt will only copy the single file to the current directory. It will ignore the other files like a.txt1 and a.txtb.
You must have tried copy c:\*.txt - that will copy all forms because the pattern matching searches both long and short (8.3) names.
You can eliminate the problem by using FINDSTR:
for /f "eol=: delims=" %F in ('dir /b /a-d c:\*.txt^|findstr /eli ".txt"') do #copy "c:\%F"
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 13 years ago.
Improve this question
In windowsxp, I use "del /s /q myfolder" to delete a big folder. It will list all files and folders being deleted. is there a way to avoid that long display list?
thanks,
rmdir /s /q myfolder
or rmdir del /s /q myfolder > nul
Which is the equivalent of the Unix/Linux's /dev/null which throws away any outputs as they are redirected to a black hole of a bit bucket...
Edit: Thanks Heinzi for my stoopid error....I have struck out the rmdir and replaced it with del :)
Hope this helps,
Best regards,
Tom.