Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

issue with batch deleting, any help?

- - - - -

  • Please log in to reply
10 replies to this topic

#1
MgmTest

MgmTest

    Junior

  • Member
  • Pip
  • 61 posts
  • Joined 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag
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"



How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,654 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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

#3
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,421 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
I say it a permission issue, if you are using Vista and up. Try to right click the script and select
Run As Admin.


GunSmokingMan



#4
MgmTest

MgmTest

    Junior

  • Member
  • Pip
  • 61 posts
  • Joined 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag
Thanks But x86 x64 windows 7.

#5
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,654 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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:
  • Which OS?
  • Which Filesystem?
  • 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, 30 September 2012 - 12:41 PM.


#6
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,421 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag


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:
  • Which OS?
  • Which Filesystem?
  • 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.


GunSmokingMan



#7
MgmTest

MgmTest

    Junior

  • Member
  • Pip
  • 61 posts
  • Joined 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag
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.

#8
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,654 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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

#9
MgmTest

MgmTest

    Junior

  • Member
  • Pip
  • 61 posts
  • Joined 13-January 12
  • OS:Windows 7 x86
  • Country: Country Flag
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.

#10
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,654 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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 Posted Image, while it doesn't for you :no: .

jaclaz

#11
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,421 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
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 




GunSmokingMan






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users