linux - Script: Rename and remove duplicate directories -


After

I'm tailoring with a different version name like a directory structure

  / drivers / I2c_vl / drivers / I2c_vl_0 / drivers / I2c_v2_l / drivers / I2c_v3 / drivers / Spi_vl / drivers / Spi_v2 / drivers / Spi_v2_0 / drivers / spi_v2_1   

I name change Need / drivers / i2c_v3 with / drivers / I2C to remove and drivers / i2c_v * and / drivers A. / spi_v2_1 with / drivers / SPI and remove / drivers / spi_v *

name of the latest version at above the rest One of the version-enforcement directorates should delete them, rename it.

Any help ...

prefix = $ $ for p in prefixes (ls / drivers / * _ v * | sed 's /_.*//' | uniq); All = ($ ($ (ls -vr $ {p} _ *)) # Sort in reverse version order Latest = $ {all [0]} # First is the highest version of MV $ latest / driver / rename # such name This will not be removed by the wildcard below if [[$ $ # all [@]} & gt; 1]]; Then # check that other than multiple versions rm- rf $ {p} _ * # # non-versioned

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -