windows 7 - Can I directly specify the file name for fsquirt.exe and have it sent instantly?
2014-07
Because modern mobile phones do not seem to work with my bluetooth software as Nokia did, I'm using microsoft's fsquirt.exe
utility. I had tried to upgrade my notebook's bluetooth software but most big corporation don't care about products sold 5years ago - so there are no updates at all.
The fsquirt
utility is run by initiating the windows Run with keys Win+R dialog and typing fsquirt.exe
.
The utility allows you to select whether you're to send on receive files. I have always used the former.
I was wondering if I could write a batch that would, preferably using fsquirt.exe
's command line parameters, make the program load a file specified by command line parameter provided to batch and that would send the file instantly, without any more mouse clicks.
I would like to delete all files and subfolders in a batch file in Windows 7 and keep the top folder. Basically emptying the folder. What's the command line instruction for that?
You can do this using del
and the /S
flag (to tell it to remove all files from all subdirectories):
del /S C:\Path\to\directory\*
The best Solution: e.g. i want to delete all files and sub-directories of parent directory lets say "C:\Users\Desktop\New folder\". The easy way is create batch file of below three commands.
cd C:\Users\Desktop\New folder\
del * /S /Q
rmdir /S /Q "C:\Users\Desktop\New folder\"
Here first it will clean all files in all sub-directories and then cleans all empty sub-directories. Since current working directory is parent directory i.e."\New folder", rmdir command can't delete this directory itself.
rmdir "c:\pathofyourdirectory" /q /s
Don't forget to use the quotes and for the /q /s
it will delete all the repositories and without prompting.
This worked better for me when I had spaces in the folder names.
@echo off
REM ---- Batch file to clean out a folder
REM Checking for command line parameter
if "%~1"=="" (
echo Parameter required.
exit /b 1
) else (
echo ***********************************************************************************
echo *** Deleting all files, including the ones in the subdirs, without confirmation ***
del "%~1\*" /S /Q
echo ***********************************************************************************
REM Deleting all the empty subdirs that were left behind
FOR /R "%~1" %%D IN (.) DO (
if "%%D"=="%~1\." (
echo *** Cleaning out folder: %~1 ***
) else (
echo Removed folder "%%D"
rmdir /S /Q "%%D"
)
)
REM All good.
exit /b 0
)
If you want to delete all files in a folder, including all subfolders and not rely on some error conditions to keep the root folder intact (like I saw in another answer) you could have a batch file like this:
@echo off
REM Checking for command line parameter
if "%~1"=="" (
echo Parameter required.
exit /b 1
) else (
REM Change directory and keep track of the previous one
pushd "%~1"
if errorlevel 1 (
REM The directory passed from command line is not valid, stop here.
exit /b %errorlevel%
) else (
REM First we delete all files, including the ones in the subdirs, without confirmation
del * /S /Q
REM Then we delete all the empty subdirs that were left behind
for /f %%D IN ('dir /b /s /a:d "%~1"') DO rmdir /S /Q "%%D"
REM Change directory back to the previous one
popd
REM All good.
exit /b 0
)
)
And then you would simply call it with:
empty_my_folder.bat "C:\whatever\is\my folder"