Posted: Fri Feb 06, 2009 5:35 pm Post subject: calc - importing dates from an ls of directory
i'm trying to make a spreadsheet using a listing of many thousands of files in a particular directory. they are movie files. i want the spreadsheet to have columns for the various bits of file info like filename, size, date modified.
i used:
ls -la /path/to/directory > dirlist.txt
to create a text file which i'm trying to import into neooffice via csv settings. it generally works, however, the date columns have given me a problem.
ls output the date as:
Aug 15 2003
for example. the text file is not really tab delimited so i'm using <space> as the delimiter. that works for everything but the date, which now breaks into three columns.
how can i get the date consolidated into a single column, either on import, or after.
here's an example of a couple of lines of text output from ls:
first, i bet i can't delete the original A1, B1, C1 columns now that i have what i want displaying via your formula. i suppose i could hide the A-C columns, but is there a way i can create the date as a standalone value, independent of the formula once it's been created?
secondly. some dates are in another format. this is really another question but i'll go ahead with it here since we're already into it.
some dates are diplayed thusly:
Feb 1 16:09
in other words, some are displayed as month/day/time. this occurs for very recent listings. calc, using the suggested formula is producing values like this when confronted with this format:
Feb 1 0.672916666666667
how do i get calc to revert to the original time value?
first, i bet i can't delete the original A1, B1, C1 columns now that i have what i want displaying via your formula. i suppose i could hide the A-C columns, but is there a way i can create the date as a standalone value, independent of the formula once it's been created?
I have an idea for your first question. You will need a new column. Select the column with the formula in it and select the menu Edit :: Copy (or another copy method if you prefer.) Place your cursor at the top of the new column and select the menu Edit :: Paste Special. In the Paste Special dialog that opens make sure the Strings box is checked in the Selection section on the left hand side. Uncheck all the other check boxes. Press the OK button to paste a text string of the date. You can now delete the other 4 columns (A, B, C and the one containing the formula.)
I do not have an answer for the second question. There are two different types of data and I do not know how to handle the time. Maybe someone else here on the forums may have an idea.
After a quick search I have an idea for your second question.
BabaG wrote:
secondly. some dates are in another format. this is really another question but i'll go ahead with it here since we're already into it.
some dates are diplayed thusly:
Feb 1 16:09
in other words, some are displayed as month/day/time. this occurs for very recent listings. calc, using the suggested formula is producing values like this when confronted with this format:
Feb 1 0.672916666666667
how do i get calc to revert to the original time value?
You could probably use ls -lT to force all the files to output in the same date format (though you'd have to change your concatenate format to match the new output format).
Otherwise, there's probably a way to toss an IF statement in for the third term (though I can't get it working right now) to return just the year if it's a year or Fran's TEXT(C1;"H:MM AM/PM") otherwise.
Smokey _________________ "[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
For your first problem, on a one-row basis you can achieve the same thing by selecting the 3 cells, doing Merge Cells on them opting to put all the contents in the first cell - and then Split Cells again will leave you with dd/mm/yyyy in the first cell.
I know this doesn't help you unles you write it into a macro that runs down the column, but it's a neat little trick for one-offs so I thought I'd post it here.
For what it's worth, there are two Merge Cells items in the Format::Merge Cells submenu with exactly the same name - they differ in how the resulting cell contents are aligned by default. The first one aligns centred/centred - the second aligns default (which for cells merged vertically means left/bottom).
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum