gravedigger Posted January 13, 2009 Share Posted January 13, 2009 What I'm looking for is a script that would delete a file where the names is the same but the extension is different for example you may have a file like 12345.dxf and 12345.dwg. In theis case I would like the script to always delete the file with the dwg extension and only if there is a dxf file with the same name. I did a search and found a script that would delete the file but only if the ext. matched as well. Thank you for any help you can provide. Link to comment Share on other sites More sharing options...
andybiochem Posted January 13, 2009 Share Posted January 13, 2009 What I'm looking for is a script that would delete a file where the names is the same but the extension is different for example you may have a file like 12345.dxf and 12345.dwg. In theis case I would like the script to always delete the file with the dwg extension and only if there is a dxf file with the same name.I did a search and found a script that would delete the file but only if the ext. matched as well. Thank you for any help you can provide._PathSplit would be a good function to use here, it will return you the name of files without extensions. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
youknowwho4eva Posted January 13, 2009 Share Posted January 13, 2009 You could use filefindfirst, and filefindnext. use filename.* (If I'm not mistakin just filename. will work too) and delete the second occurrence and beyond. Giggity Link to comment Share on other sites More sharing options...
KaFu Posted January 13, 2009 Share Posted January 13, 2009 Take a look at SMF ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gravedigger Posted January 13, 2009 Author Share Posted January 13, 2009 Take a look at SMF ...I did I was unable to configure it to do what I'm looking at doing, any suggestions? Link to comment Share on other sites More sharing options...
Andreik Posted January 13, 2009 Share Posted January 13, 2009 I did I was unable to configure it to do what I'm looking at doing, any suggestions?#include <File.au3> $FOLDER = FileSelectFolder("SELECT","") $FILE = _FileListToArray($FOLDER,"*.*",1) For $INDEX = 1 To $FILE[0] If StringRight($FILE[$INDEX],4) = ".dxf" Then If FileExists($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") Then FileDelete($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") EndIf EndIf Next When the words fail... music speaks. Link to comment Share on other sites More sharing options...
KaFu Posted January 13, 2009 Share Posted January 13, 2009 (edited) I did I was unable to configure it to do what I'm looking at doing, any suggestions?Point to Path to search and set filter for filename in report to '12345.%' ...Best Regards Edited January 13, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gravedigger Posted January 13, 2009 Author Share Posted January 13, 2009 #include <File.au3> $FOLDER = FileSelectFolder("SELECT","") $FILE = _FileListToArray($FOLDER,"*.*",1) For $INDEX = 1 To $FILE[0] If StringRight($FILE[$INDEX],4) = ".dxf" Then If FileExists($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") Then FileDelete($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") EndIf EndIf NextIt worked like a charm thank you very much. You have no idea how much time you saved me! Link to comment Share on other sites More sharing options...
gravedigger Posted January 13, 2009 Author Share Posted January 13, 2009 Point to Path to search and set filter for filename in report to '12345.%' ...Best RegardsThank you I will give this another try as well. (Now all I need is for you guys to teach me how to write these scripts myself) Link to comment Share on other sites More sharing options...
KaFu Posted January 13, 2009 Share Posted January 13, 2009 Thank you I will give this another try as well. (Now all I need is for you guys to teach me how to write these scripts myself)No problem, take a look at the source, its available ... *doooh*, just see that the exe creation date is wrong in the last version, its 2009 not 2008 , corrected in next ver...Best Regards OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gravedigger Posted January 14, 2009 Author Share Posted January 14, 2009 #include <File.au3> $FOLDER = FileSelectFolder("SELECT","") $FILE = _FileListToArray($FOLDER,"*.*",1) For $INDEX = 1 To $FILE[0] If StringRight($FILE[$INDEX],4) = ".dxf" Then If FileExists($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") Then FileDelete($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") EndIf EndIf NextWhat changes would I need to make so that the destination folder would not have to be selected, but placed directly into the script? Link to comment Share on other sites More sharing options...
KaFu Posted January 14, 2009 Share Posted January 14, 2009 #include <File.au3> $FOLDER = 'c:\temp\' $FILE = _FileListToArray($FOLDER,"*.*",1) For $INDEX = 1 To $FILE[0] If StringRight($FILE[$INDEX],4) = ".dxf" Then If FileExists($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") Then FileDelete($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") EndIf EndIf Next OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gravedigger Posted January 14, 2009 Author Share Posted January 14, 2009 #include <File.au3> $FOLDER = 'c:\temp\' $FILE = _FileListToArray($FOLDER,"*.*",1) For $INDEX = 1 To $FILE[0] If StringRight($FILE[$INDEX],4) = ".dxf" Then If FileExists($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") Then FileDelete($FOLDER & "\" & StringTrimRight($FILE[$INDEX],4) & ".dwg") EndIf EndIf NextThank you! Link to comment Share on other sites More sharing options...
simpsoid3 Posted January 20, 2009 Share Posted January 20, 2009 I'm not sure,but tryduplicate file removal , i think it will help you! Link to comment Share on other sites More sharing options...
gravedigger Posted January 20, 2009 Author Share Posted January 20, 2009 I'm not sure,but tryduplicate file removal , i think it will help you!I ended up using the script that Andreik provided, I made some change to have it run in the background and popup a message when it find a file and then deletes it. Our drafters are switch all our drawing over to DXF and are to lazy to delete the dwg which was causing issues in product. This is working really well, everyone is thinking I'm going throught the folder and deleting them manually which somedays would take hours. This way it takes seconds. Thanks again. Link to comment Share on other sites More sharing options...
rocksandbikes Posted March 10, 2014 Share Posted March 10, 2014 Please excuse the NOOB question, this looks like exactly what I am trying to do. We have moved over from local file servers to google drive, as I move over a department I am allowing the conversions to take place but then I am left with copies of the original (.doc, .docx, .xlsx etc) files and the google doc ones in my synched drives... ( I need to keep synching a local drive to it for now as part of the switch over).. Can I generate something like this to run in a batch file that will execute in the folder I have the batch file in but also to work its way down through all subfolders.. (I am looking at 7000 folders....) Many thanks in advance for any support, R&B. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 10, 2014 Moderators Share Posted March 10, 2014 rockasandbikes, resurrecting a thread that is 5 years old is never a good idea. AutoIt has grown substantially as a language in the past few years, and what worked in 2009 may not work the same today. Your best bet would be to start a new topic and explain in detial what you are trying to accomplish. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
skillet19738 Posted March 12, 2014 Share Posted March 12, 2014 (edited) There are different ways on how you can do this. The first and the easiest method is by means of using a tool that has been designed for this kind of task. The first thing that you have to do here is to download the software which will provide you with the answer to your needs. You may have to research on the program that is appropriate for comparing and find duplicate files. One of the tasks that are very common is to find Word files. There are tools that can help you with this but if you would like to match images in your system, they are not applicable. You may have to find a specialized tool that can help you find and compare the photos, graphics and images in your computer Edited March 12, 2014 by Melba23 Removed badly hidden URL Link to comment Share on other sites More sharing options...
kellynorwin Posted April 14, 2015 Share Posted April 14, 2015 DuplicateFilesDeleter is the best way possible to remove the duplicate files. And clear your drives. It has very special algorithm that processes all data byte by byte. That way I cleared my disk from duplicate files, warmly I recommend it to try if you have problem. 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