Jump to content

issue with batch deleting, any help?


Recommended Posts

my folder name is in () It can't delete the file inside of it.

also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.


+ChristophMaitland+Veela-Fall silently.flp

FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /q

del "%ProgramFiles%\Test\(CF3 Support)\Preset Sample Image.png"

Link to comment
Share on other sites


my folder name is in () It can't delete the file inside of it.

also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.


+ChristophMaitland+Veela-Fall silently.flp

FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /q

del "%ProgramFiles%\Test\(CF3 Support)\Preset Sample Image.png"

Which OS?

Which Filesystem?

It works here on XP/NTFS ( having set ProgramFiles(x86)=C: ) what is the output of

SET  ProgramFiles

?

@ECHO OFF
SET ProgramFiles(x86)=C:
SET Program
ECHO.
DIR /S /B "%ProgramFiles(x86)%\Test\(CF3 Support)\"
ECHO.
FOR /D %%p IN ("%ProgramFiles(x86)%\Test\(CF3 Support)\*.*") DO rmdir "%%p" /s /q

DIR /S /B "%ProgramFiles(x86)%\Test\(CF3 Support)\"

C:\test>rmdirtest.cmd

ProgramFiles=C:\Programmi

ProgramFiles(x86)=C:

C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)

C:\Test\(CF3 Support)\A_file.txt

C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)\+ChristophMaitland+Veela-Fall silently.flp

C:\Test\(CF3 Support)\a folder with spaces (and + and - and brackets)\Zircon-Just (alpha team remix).flp

C:\Test\(CF3 Support)\A_file.txt

C:\test>

jaclaz

Link to comment
Share on other sites

Thanks But x86 x64 windows 7.

I say it a permission issue, if you are using Vista and up. Try to right click the script and select

Run As Admin.

:whistle:

In order to try and help people (actually coming here and asking for help) we often need to ask questions.

You can easily spot them because they have a small "hook" sign "?" at the end.

You were asked THREE of them:

  1. Which OS?
  2. Which Filesystem?
  3. what is the output of "SET ProgramFiles"?

Right now we have a (vague) answer to only the first one, i.e. now we know that you are running Windows 7 (and probably the 64 bit version of it), and such a system WILL have issues with permissions IF the target is on a NTFS filesystem (question #2) AND it is run NOT with Administrator permission.

Them someone may suggest you to try something, like:

Try to right click the script and select Run As Admin.

It would be nice if you could actually try the suggestion and report what happens. :yes:

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

Thanks But x86 x64 windows 7.

I say it a permission issue, if you are using Vista and up. Try to right click the script and select

Run As Admin.

:whistle:

In order to try and help people (actually coming here and asking for help) we often need to ask questions.

You can easily spot them because they have a small "hook" sign "?" at the end.

You were asked THREE of them:

  1. Which OS?
  2. Which Filesystem?
  3. what is the output of "SET ProgramFiles"?

Right now we have a (vague) answer to only the first one, i.e. now we know that you are running Windows 7 (and probably the 64 bit version of it), and such a system WILL have issues with permissions IF the target is on a NTFS filesystem (question #2) AND it is run NOT with Administrator permission.

Them someone may suggest you to try something, like:

Try to right click the script and select Run As Admin.

It would be nice if you could actually try the suggestion and report what happens. :yes:

jaclaz

Now any body with half a brain wouldm of seen this, "%ProgramFiles% and that on Vista and up and if the UAC has not been disable

it requires Admin rights to delete any folder or contents.

Link to comment
Share on other sites

Hi I am using windows 7 x86 and also x64 with NTFS file system and also uac is disabled, but it doesn't work for me. also I want it to be compatible with vista and windows 8. thanks guys for your helps.

Link to comment
Share on other sites

Hi I am using windows 7 x86 and also x64 with NTFS file system and also uac is disabled, but it doesn't work for me.

Too bad. :(

also I want it to be compatible with vista and windows 8.

Good luck :).

thanks guys for your helps.

Why? :w00t: You evidently do not want to get help. :no:

jaclaz

Link to comment
Share on other sites

haha you are funny but being funny is not answer to may question.

as I mentioned before this is my problem: my folder name is in () It can't delete the file inside of it.

also if the file name is like Zircon-Just (alpha team remix).flp" or having + in it's name can't getting delete.

the script you gave me doesn't work fine on all version of windows I look for something which is working fine and smooth on all version of windows.

Link to comment
Share on other sites

haha you are funny but being funny is not answer to may question.

EXACTLY like your posts are NOT the anwers to the questions I asked, but are merely a re-post.

So we are perfectly even :thumbup , you don't answer to the questions I ask, and I do not provide an answer to your question/problem, the difference being that everything works for me smiling9.gif, while it doesn't for you :no: .

jaclaz

Link to comment
Share on other sites

1:\ Are you trying to remove %ProgramFiles(x86)%\Test\(CF3 Support)\ and all it sub folders and files?

2:\ Or are you trying to remove from %ProgramFiles(x86)%\Test\(CF3 Support)\ all the files and leave the folder empty?

Here is a VBS script that I tested to remove a folder in the Programfiles

Test Path = C:\Program Files (x86)\Test-(Delete) Me

Remove Folder

How I ran it on Win 7 x64 UAC enable

1:\ Open Cmd Promt with admin right

2:\ CD to script location EG CD C:\Users\Gunsmokingman\Desktop

3:\ Type this in Cmd Promt Window Wscript Test_Delete_ProgramFiles.vbs

VBS Script


Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Loc :Loc = "C:\Program Files (x86)\Test-(Delete) Me"
If Fso.FolderExists(Loc) Then Fso.DeleteFolder(Loc),True

List Files In ProgramFiles Folder

How I ran it on Win 7 x64 UAC enable

1:\ Open Cmd Promt with admin right

2:\ CD to script location EG CD C:\Users\Gunsmokingman\Desktop

3:\ Type this in Cmd Promt Window Cscript Test_Delete_ProgramFiles.vbs

this will show all the files in the parent directory in the Cmd Promt window

VBS Script


Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Loc :Loc = "C:\Program Files (x86)\Test-(Delete) Me"
' If Fso.FolderExists(Loc) Then Fso.DeleteFolder(Loc),True

Dim Obj
For Each Obj In Fso.GetFolder(Loc).Files
WScript.Echo Obj
'Fso.DeleteFile(Obj),True
Next

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...