Jump to content
Sign in to follow this  
gravedigger

Delete Duplicate files with different extensions

Recommended Posts

gravedigger

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.

Share this post


Link to post
Share on other sites
andybiochem

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!

Share this post


Link to post
Share on other sites
youknowwho4eva

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

Share this post


Link to post
Share on other sites
KaFu
gravedigger

Take a look at SMF :)...

I did I was unable to configure it to do what I'm looking at doing, any suggestions?

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
KaFu

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.%' :)...

Posted Image

Best Regards

Edited by KaFu

Share this post


Link to post
Share on other sites
gravedigger

#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
It worked like a charm thank you very much. You have no idea how much time you saved me!

Share this post


Link to post
Share on other sites
gravedigger

Point to Path to search and set filter for filename in report to '12345.%' :)...

Posted Image

Best Regards

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)

Share this post


Link to post
Share on other sites
KaFu

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 :lmao:... *doooh*, just see that the exe creation date is wrong in the last version, its 2009 not 2008 :), corrected in next ver...

Best Regards

Share this post


Link to post
Share on other sites
gravedigger

#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
What changes would I need to make so that the destination folder would not have to be selected, but placed directly into the script?

Share this post


Link to post
Share on other sites
KaFu

#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

Share this post


Link to post
Share on other sites
gravedigger

#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
Thank you!

Share this post


Link to post
Share on other sites
gravedigger

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.

Share this post


Link to post
Share on other sites
rocksandbikes

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
skillet19738

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 by Melba23
Removed badly hidden URL

Share this post


Link to post
Share on other sites
kellynorwin
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.
 

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  

×