Sponsored Content
Top Forums Shell Programming and Scripting Script to compare partial filenames in two folders and delete duplicates Post 302989380 by shaky on Wednesday 11th of January 2017 10:25:05 PM
Old 01-11-2017
Script to compare partial filenames in two folders and delete duplicates

Background: I use a TV tuner card to capture OTA video files (.mpeg) and then my Plex Media Server automatically optimizes the files (transcodes for better playback) and places them in a new directory. I have another Plex Library pointing to the new location for the optimized .mp4 files. This results in two folders containing files with the same name except for the file extension. My goal is to run a script every x number of minutes/hours to delete the original .mpeg files if the Plex server has already optimized them. I'm familiar with crontab well enough to set the script to run periodically but cannot figure out how to create the script to compare/delete the files.

Example;

Original video files:
Code:
/mnt/Plex/DVR/Original/
episode1mmddyyyy.mpeg
episode2mmddyyyy.mpeg
episode3mmddyyyy.mpeg

Optimized video files:
Code:
/mnt/Plex/DVR/Optimized/
episode1mmddyyyy.mp4
episode2mmddyyyy.mp4
episode3mmddyyyy.mp4


The script would compare files in the two directories (minus the file extensions) and delete all files in /mnt/Plex/DVR/Original/ that match. In the example above all files in /mnt/Plex/DVR/Original/ would be deleted to save space on the hard drive.

Any insight is appreciated.

Last edited by rbatte1; 01-12-2017 at 07:45 AM.. Reason: Added CODE tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script to partial delete

guys i need some help in writing a shell script, what i am trying to write is a shell script that can delete generated trace files my software usually generated everyday, i will give an example to make it easy to understand root@cms-db # pwd /pcard17/trace root@cms-db # ls -l HSM_VERIF.TRC*... (4 Replies)
Discussion started by: q8devilish
4 Replies

2. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

3. Shell Programming and Scripting

Delete duplicates via script?

Hello, i have the following problem: there are two folders with a lot of files. Example: FolderA contains AAA, BBB, CCC FolderB contains DDD, EEE, AAA How can i via script identify AAA as duplicate in Folder B and delete it there? So that only DDD and EEE remain, in Folder B? Thank you... (16 Replies)
Discussion started by: Y-T
16 Replies

4. Shell Programming and Scripting

Remove the partial duplicates by checking the length of a field

Hi Folks - I'm quite new to awk and didn't come across such issues before. The problem statement is that, I've a file with duplicate records in 3rd and 4th fields. The sample is as below: aaaaaa|a12|45|56 abbbbaaa|a12|45|56 bbaabb|b1|51|45 bbbbbabbb|b2|51|45 aaabbbaaaa|a11|45|56 ... (3 Replies)
Discussion started by: asyed
3 Replies

5. Shell Programming and Scripting

HELP! Need to compare 2 folders on 2 different systems, and copy unmatched filenames to other folder

This has been tearing my hair out. I need to: 1: compare server1:/data/archive/ to server2:/data/archive/ (through rsync, ssh, etc) 2: filenames that don't match, get copied (scp) to server2:/data/ server1 and server2 have ssh, scp, rsync access between eachother. Is there any option in... (3 Replies)
Discussion started by: damang111
3 Replies

6. Shell Programming and Scripting

Linux Script to compare two folders and copy missing files

Hi, I need help in shell scripting. If someone can help me, that would be great! Problem. I want Linux Script to compare two folders and copy missing files. Description. I have two directories /dir1 /dir2 I need to copy all distinct/new/unique/missing files from /dir1 and that... (1 Reply)
Discussion started by: S.Praveen Kumar
1 Replies

7. Shell Programming and Scripting

Script to compare substrings of multiple filenames and move to different directory

Hi there, I am having trouble with a script I have written, which is designed to search through a directory for a header and payload file, retrieve a string from both filenames, compare this string and if it matches make a backup of the two files then move them to a different directory for... (1 Reply)
Discussion started by: alcurry
1 Replies

8. Shell Programming and Scripting

Script to delete folders and files from a prompt

Hi Everyone, I work for GE Money IVR as a DB analyst and the environment on which I work is Solaris 5.0 server and Oracle 11g. I got a project in which I have to clean up the folders and files which are not used in DB. I copied an existing script and edited it, dont know this is the... (5 Replies)
Discussion started by: habeeb506
5 Replies

9. Shell Programming and Scripting

Script to compare files in 2 folders and delete the large file

Hello, my first thread here. I've been searching and fiddling around for about a week and I cannot find a solution.:confused: I have been converting all of my home videos to HEVC and sometimes the files end up smaller and sometimes they don't. I am currently comparing all the video files... (5 Replies)
Discussion started by: Josh52180
5 Replies

10. UNIX for Beginners Questions & Answers

How can I remove partial duplicates and manipulate text?

Hello, How can I remove partial duplicates and manipulate text in bash using either awk, grep or sed? Thanks. Input: ted,"foo,bar,zoo" john-son,"foot,ben,zoo" bob,"bar,foot" Expected Output: foo,ted bar,ted zoo,ted foot,john-son ben,john-son (4 Replies)
Discussion started by: tara123
4 Replies
BKTR(4) 						   BSD Kernel Interfaces Manual 						   BKTR(4)

NAME
bktr -- Brooktree Bt848/849/878/879 and Pinnacle PCTV video capture driver SYNOPSIS
device bktr device iicbus device iicbb device smbus DESCRIPTION
The bktr driver provides support for PCI video capture and VBI capture on low cost, high performance boards. The driver is based on the Matrox Meteor driver and uses the same API. The bktr driver should support most video cards based on the Brooktree Bt848/849/878/879 Video Capture Chip. Also supported are most Pinnacle PCTV video cards. Furthermore, the driver supports FM Radio if the tuner supports it. The driver currently supports the following features: PCI to PCI dma transfer clipping yuv rgb16 rgb24 rgb32 On the supported cards, tuners and other components are interconnected with an I2C bus. The Brooktree848 chips act as a master device on the bus to control them. Therefore, iicbus(4), iicbb(4) and smbus(4) controller declarations are mandatory to activate bktr support. The following kernel parameters may be used to further configure the driver: options BROOKTREE_ALLOC_PAGES=xxx specifies the number of contiguous pages to allocate when successfully probed. The default number of pages allocated by the kernel is 216. This means that there are (216*4096) bytes available for use. options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC One of these options can be used to set the default video format for the driver. This fixed random hangs and lockups with the VideoLogic Captivator PCI card. The following sysctls may be used to further configure the driver: sysctl hw.bt848.card=nnnn This can be used to override the card make which was detected at boot time. 'nnnn' is set to an integer from 1 to 23 taken from the following table: MIRO 1 HAUPPAUGE 2 STB 3 INTEL 4 IMS_TURBO 5 AVER_MEDIA 6 OSPREY 7 NEC_PK 8 IO_GV 9 FLYVIDEO 10 ZOLTRIX 11 KISS 12 VIDEO_HIGHWAY_XTREME 13 ASKEY_DYNALINK_MAGIC_TVIEW 14 LEADTEK 15 TERRATVPLUS 16 IO_BCTV3 17 AOPEN_VA1000 18 PINNACLE_PCTV_RAVE 19 PIXELVIEW_PLAYTV_PAK 20 TERRATVALUE 21 PIXELVIEW_PLAYTV_PRO_REV_4C 22 Bt848_MAX 23 sysctl hw.bt848.tuner=nnnn This can be used to override the tuner make which was detected at boot time. 'nnnn' is set to an integer from 0 to 16 taken from the following table: NO_TUNER 0 TEMIC_NTSC 1 TEMIC_PAL 2 TEMIC_SECAM 3 PHILIPS_NTSC 4 PHILIPS_PAL 5 PHILIPS_SECAM 6 TEMIC_PALI 7 PHILIPS_PALI 8 PHILIPS_FR1236_NTSC 9 /* These have FM Radio support */ PHILIPS_FR1216_PAL 10 /* These have FM Radio support */ PHILIPS_FR1236_SECAM 11 /* These have FM Radio support */ ALPS_TSCH5 12 ALPS_TSBH1 13 MT2032 14 LG_TPI8PSB12P_PAL 15 Bt848_MAX 16 HARDWARE
The bktr driver supports video capture cards based on the Brooktree Bt848/849/878/879 chips, as well as Pinnacle PCTV cards, including: o AOpen VA1000 o AVerMedia AVerTV Studio o AVerMedia TF/FM-98 o ATI TV Wonder VE o Hauppauge WinCast/TV o Hauppauge WinTV-Go-FM o Hauppauge WinTV-pci o Hauppauge WinTV-radio o Intel Smart Video Recorder III o KWORLD PCI TV Tuner o Miro PC TV o Pinnacle PCTV Pro o Pinnacle PCTV Rave o PixelView PlayTV PAK o PixelView PlayTV Pro (rev 4C, 9D) o SIGMA TV II o STB TV PCI Television Tuner o Super TV Tuner o TerraTec TValue o V-Stream XPERT TV-PVR 878 o Video Highway XTreme o VideoLogic Captivator PCI FILES
/usr/share/examples/meteor Examples of what you can do with the (similarly designed) Meteor driver. /usr/ports/multimedia/fxtv A TV and Camera display program utilizing the bktr driver - requires that The X Window System and The Ports Collection also be installed. /usr/ports/misc/alevt A program to capture and display Teletext (VideoText) pages - requires that The X Window System and The Ports Collection also be installed. /usr/ports/audio/xmradio An FM Radio Tuner for cards which have an FM Radio tuner fitted - requires that The X Window System and The Ports Collection also be installed. It also requires Motif or the lesstif port. SEE ALSO
meteor(4) HISTORY
The bktr driver first appeared in FreeBSD 2.2. AUTHORS
This driver is based on the work of Jim Lowe <james@miller.cs.uwm.edu>, Mark Tinguely <tinguely@plains.nodak.edu>, Amancio Hasty <hasty@star-gate.com>, Roger Hardiman <roger@FreeBSD.org> and a bunch of other people. Support for Pinnacle PCTV Rave cards was added by Branko Lankester <branko@euro.net>. BSD
January 18, 2006 BSD
All times are GMT -4. The time now is 08:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy