• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Selection of only modified files

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to create a shell script to move only modified files with the exact folder structure to another place. Could anyone please tell me how to distinguish the modified files?
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Linux doesn't keep a "modified" flag for files - it keeps a timestamp. The DOS "modified" bit was handy for a single-user-system - the backup programs could set/reset it. But the Unix people tend to do things that are more devious.

There are a couple of options.

1. Check the original date against the change (modified) date. However, unlike the DOS Modified flag, there's no way to switch this off after you've done whatever operation is interested in modified files. Once modified, it's "modified" forever.

2. Check the change date against an absolute date. A number of *n*x utilities, including find and tar can do that, as well as bash builtin functions. This is what's usually used for incremental or differential backups.

There's also some tricks that involve keeping inventory of dates, but they're more specialized.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic