Reputation: 583
Hey guys i need to know how to hide a file of which i dont know the name of.
for instance i have 6 folders named 1-6 but i think that their named a-f. and their directory is C:\users\all users\bond.
how would i go about doing this?
I dont need to hide the directory of which the files are located i need to be able to enter the directory and hide the files within.
here's the only thing i can think of:
@echo off
cd C:\users\all users\bond
attrib +h +s %filename% *
echo.
echo files successfully hidden.
pause
exit
Upvotes: 0
Views: 399
Reputation: 2592
You could iterate over the folders.
The for
command can takes a list of folder names or wildcards.
@echo off
cd /d c:\users\all users\bond
for /d %%D in (FOLDER NAMES GO HERE) do (
pushd %%D
attrib +h *.*
popd
)
exit /b
If you need to process all the folders in the current directory, just put *
there:
...
for /d %%D in (*) do (
...
You could also not change to the parent directory but specify it in the for
loop instead (note the quotes around the mask):
@echo off
for /d %%D in ("c:\users\all users\bond\*") do (
...
Similarly, you could omit jumping in to and out of each subdirectory and instead specify the path in the attrib
command.
So, the above script could be rewritten like this:
@echo off
for /d %%D in ("c:\users\all users\bond\*") do attrib +h "%%D\*"
exit /b
Upvotes: 1