Sign in to follow this  
Followers 0
AXPPES

Make a script that can delete a line in several files automatically

6 posts in this topic

Hello Guys,

I need help creating something that could update more than 10000 files inside a folder... I need the following:

I have several files with diferente names but that ende with *.rcf (opens eith notepad) inside I have:

[Main]

SendStatusFile=YES

Log=YES

IniFile=*.INI

[Host]

HostName=200.99.137.234

I need to delete de following line:

IniFile=*.INI

(* This as several names)

In all files.....

Do you know how to do it?

Thanks

Share this post


Link to post
Share on other sites



AXPPES,

Use _FileListToArray to get a list of the .rcf files in the folder. Then loop through the list and use _FileReadToArray to get the contents into an array. Loop through that array and remove the line you want with _ArrayDelete. Finally use _FileWriteFromArray to rewrite the file. :)

Give it a go yourself - you know where we are if you need a hand. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Just one question.....the folder as other folders....does this comands work inside the subfolders or do I have to do it one folder by folder?

Thanks for the help

Share this post


Link to post
Share on other sites

AXPPES,

If you want to look in subfolders as well then use my RecFileListToArray UDF to list all the files - look in my sig for the link. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

AXPPES,

If you want to look in subfolders as well then use my RecFileListToArray UDF to list all the files - look in my sig for the link. ;)

M23

Sorry...I am very new at this?

Where should I look?

thanks,

Share this post


Link to post
Share on other sites

AXPPES,

There is a list of my UDFs at the bottom of my post. Click on the red RecFileListToArray in that list and you are linked to the thread which deals with the UDF. You can then download the zip file and use the UDF - just put it into the same folder as your script. :)

If you want it to available to all your scripts in the same way as the normal AutoIt UDFs, then the Adding UDFs to AutoIt and SciTE tutorial in the Wiki tells you how to proceed. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0