kashifabb Posted March 7, 2013 Share Posted March 7, 2013 I wanted to make a script which saves the list of files in a folder (dir excluding subfolder) only filea with prefix of custom location in text fileLikeMy folder A has file 1.txt, 2.jpg, 3.png etc Prefix to add "http://website/doc/"so when i run the script it should save the txt file ashttp://website/doc/1.txthttp://website/doc/2.jpghttp://website/doc/3.pngi think friend u got my point this can be done through batch file even but i dont know how, and to create a scripti created a batch with commands but didnt get the desire result command was @echo offdir /p >filelist.txtbut this is not what i wantHelp needed ! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2013 Moderators Share Posted March 7, 2013 kashifabb,Welcome to the AutoIt forum. What you want to do is very easy in AutoIt. Look at the following functions in the Helpfile:_FileListToArray - gets an array listing of the files in the folder.For...Next - lets you loop through the array so you can add the prefix using the & operator _FileWriteFromArray - write the array to fileGive it a go yourself and see how you get on - you know where we are if you run into difficulties. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Danyfirex Posted March 7, 2013 Share Posted March 7, 2013 try this: #include <File.au3> #include <Array.au3> Local $sFile = @ScriptDir & "\Test.txt" Local $FileListxt = _FileListToArray(@DesktopDir) local $i=1 Local $prefi="http://website/doc/" If @error = 1 Then MsgBox(0, "", "No Folders Found.") Exit EndIf If @error = 4 Then MsgBox(0, "", "No Files Found.") Exit EndIf _ArrayDisplay($FileListxt) for $i=1 to $FileListxt[0] $FileListxt[$i]=$prefi&$FileListxt[$i] next _ArrayDisplay($FileListxt) _FileWriteFromArray($sFile,$FileListxt,1) regards Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
kashifabb Posted March 11, 2013 Author Share Posted March 11, 2013 (edited) Thanks alot my dear Melba23 and DanyfirexAnd dear danyfirex thanks much, bcoz i dont wanted to go through loops and direcctory studies though i will later on, so ur code was real helpThanks guys But Freind there is only one problemMy files are suppossed located in"C:userpublicpic" and this folder contains files 1.txt, 2.jpg, 3.png etc Prefix to add "http://website/doc/" and if poosible popup dialog to ask for this location at start of this script so if change to change prefix can easily.when saving file it should trim "c:userpublic" but keep "pic" and change to forward lash (means should keep whatever comes after "public")And save filelist as "http://website/doc/pic/1.txt" Edited March 11, 2013 by kashifabb Link to comment Share on other sites More sharing options...
nitekram Posted March 11, 2013 Share Posted March 11, 2013 kashifabb,Welcome to the AutoIt forum. Give it a go yourself and see how you get on - you know where we are if you run into difficulties. M23 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
kashifabb Posted March 11, 2013 Author Share Posted March 11, 2013 Buddy i know but for that i need to go tthourgh all of syntaxs and vars, macro, but this time i need bit code help So friends help needed. Link to comment Share on other sites More sharing options...
nitekram Posted March 11, 2013 Share Posted March 11, 2013 (edited) You will get the same response from most, if not, all member here. We try to help when we can, but are not going to do all the work. Melba23 gave you a good starting point, and you were given most of the code to do what you want to do - so if you put a little effort into your project - you will get a better response.I know some members would just tell you to got to www.rentacoder.com/ for what you want.EDITI just reread what you are looking to do. I am not sure we are on the same page. Are you trying to get a list created of the files? And the last part where you want to save them back to HTTP - that is not going to be possible. You might be able to save them to FTP, but that does not look like what you want.Maybe break it down a little better - what you are trying to do, cause you are not going to be able to save the files. But you can save a listing of said files - is that what you are looking to do? Edited March 11, 2013 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now