Spring forward file fixing

By Sandra Henry-Stocker  Add a new comment

Springing ahead brings the promises of after work daylight hours, but always leaves me grouchy and out of sorts for a few days. It's just one hour, of course, that we push our clocks forward. Even so, experts in chronobiology — the study of how our internal clocks, our adaptation to solar and lunar rhythms, work — say it's pretty normal for people to take several days to adjust when we move our clocks ahead every Spring. So, yawn along with me while I explain how I found files on a Unix server dating not back to prior era but springing forward all the way to 2036!

I was checking a system to make sure that it was receiving data updates from a remote host when I discovered the futuristic files. I had been running a find command to provide me with a list of files that were less than one day old. To my surprise, I found about thirty files all dating forward to 2036. This is not a complete surprise. After all, the format of the Unix date command is a bit unwieldy at times. It's easy to forget whether one has to include the year and, if so, whether it goes at the beginning or end of the date string. Since I know how easy it is to make a mistake using the date command, I always follow a date reset with a second date command to make sure the date and time looks like what I expect to see. Otherwise, I try again or read the man page to figure out what I did wrong. Somehow, whether through a date error on this server or a transfer of files from another system with a date problem, we ended up with files dated far into the future.

My "find -mtime -1" command found the "future files" along with more than a hundred files that had been legitimately updated within the previous 24 hours or so. To get a list of only those files with dates stretching forward into the future, I ran a find command with "-mtime -0" -- in other words, "younger than brand new".

While I had no way to know what an appropriate time stamp would have been for any of these files, I wanted to grab them back from the far flung future if only to ensure that legitimately newer versions of the same files would be able to bump them if some "if newer than" logic were being applied.

My approach for updating the files was to use a find command to create a file list and then examine a long listing of each file before running the touch command to make each file's timestamp current. A reference file could be have been used instead if I wanted to give the files an earlier date, but I just didn't want them to be the newest files on the system for the next 27 years. The feedback also served to confirm how many files were affected by the problem and to see if there was anything that tied them together (e.g., names or file system locations).

find . -mtime -0 -ls > /tmp/futfiles

for file in `cat /tmp/futfiles | awk '{print $NF}'`
do     
    ls -l $file
    echo -n "> "
    read ans
    touch $file
    ls -l $file
done

ITworld LIVE

IT Management/StrategyWhite Papers & Webcasts

White Paper

The Cloud: Reinventing Enterprise Collaboration

Collaboration and content sharing are not, of course, new concepts. But cloud computing has changed the nature of collaboration, content sharing, document storage and project management to enable more efficient, faster-acting and cost-effective enterprises. According to a new study by IDG Research, the vast majority of knowledge workers (86%) placed a very high level of importance on collaborating with internal coworkers and external stakeholders, and having access to the most up-to-date corporate information. Read how organizations are realizing massive productivity gains by transitioning their content management solutions to cloud-based models.

White Paper

Empowering Your Mobile Worker

Today's most productive employees are mobile, and your company's IT strategy must be ready to support them with 24/7 access to the business information they need across a range of mobile devices.See how corporations are meeting the many needs of their mobile workers with the help of Box.

White Paper

Market Landscape Report: Online File Sharing and Collaboration in the Enterprise

The trend toward "consumerization" marches onward in IT; more and more end-users are choosing their own hardware plaforms and software applications in lieu of the IT-sanctioned business tools provided by their companies. These end-users are looking to tackle issues like data sharing, portability, and access from multiple intelligent endpoint devices, creating a conundrum for IT as it needs to balance business enablement, ease of access, and collaborative capacity with the need to maintain control and security of information assets. This need for balance is one of the drivers of the fast growing online file sharing and collaboration segment of the SaaS market. This paper examines the market drivers, inhibitors, and top vendors in this segment, including Box, Citrix Sharefile, Dropbox, Egnyte, Nomadesk, Sugarsync, Syncplicity and YouSendIt.

White Paper

Sharing Simplified - Consolidating File-sharing Technologies

Employees need to share content with colleagues within their organization and outside. Yet, ECMs make it hard to share content within a business and impossible between organizations. Read how one company consolidated multiple file sharing technologies to increase productivity and reduce complexity.

White Paper

Content Sharing 2.0: The Road Ahead

A growing number of companies are taking advantage of the natural synergies that exist between cloud-based IT services and content access and sharing. Legacy content management and collaboration systems simply weren't designed to meet the evolving requirements of today's IT and business managers, as well as the needs of content users. Box provides cloud-based content storage, access and collaboration services that require virtually no user training and supports file access and delivery on almost all popular PC and mobile devices. Read how Box let companies rapidly implement a cost-effective and secure content storage and sharing system that can easily expand to accommodate any size and number of files.

See more White Papers | Webcasts

Ask a question

Ask a Question