From: Henri Bourbon <npecca@yahoo.com> To: Vladimir Karpinsky <mandrake-russian@altlinux.ru> Subject: Re[2]: [mdk-re] File creation time in Linux & others Date: Tue Sep 4 15:27:13 2001 Message-ID: <10817968116.20010904152931@yahoo.com> (raw) In-Reply-To: <1264710252.20010904122954@beep.ru> Tuesday, September 04, 2001, 12:29:54, Vladimir Karpinsky wrote: >>> можно ли как-нибудь средствами shell, может быть perl(?), в имя файла >>> вставить дату его создания? HB>> Дата создания файла? А такое вообще в Linux бывает? > Я имею ввиду ту дату, которую показывает ls -l, ее вероятно правильнее > называть датой последней модификации, но в моем случае это не имеет > значения, т.к. файл не меняется после его создания. > Чуть подробнее опишу задачу: есть файлы данных, у которых дата > создания/модификации соответствует первому отсчету, хочется эту дату > вытащить в имя файла, дабы облегчить себе задачу поиска нужного. Вы, действительно, лишь *чуть* подробнее описали задачу :) Лучше всего было бы привести 1 пример, тогда все было бы понятно. Как я понял, вам нужно следующее: имеем файл foo, дата модификации к-рого -- 1 янв 1990. Нужно переименовать его в "foo.1 янв 1990" или что-то в таком духе. Делается это несложно: $ ls data1 data2 data3 data4 $ ls -l total 66 -rw-r--r-- 1 0 everyone 17168 Jan 12 1997 data1 -rw-r--r-- 1 0 everyone 32768 Dec 23 1998 data2 -r--r--r-- 1 0 everyone 61952 Dec 3 1999 data3 -rw-r--r-- 1 0 everyone 18944 Feb 2 2001 data4 $ add_mtime_to_filename * $ ls data1.Sun_Jan_12_1997 data3.Fri_Dec_03_1999 data2.Wed_Dec_23_1998 data4.Fri_Feb_02_2001 Что и требовалось доказать. А мини-скриптик add_mtime_to_filename таков: $ cat /Tools/add_mtime_to_filename #!sh FORMAT="%a_%b_%d_%Y" # Формат даты изменить по вкусу for file do mv "$file" "$file.`date --reference=$file +"$FORMAT"`" done -- HB
next prev parent reply other threads:[~2001-09-04 15:27 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-09-02 0:25 [mdk-re] скрипт из под крона не хочет перенаправлятьвывод Alex 2001-09-04 10:23 ` [mdk-re] " Vladimir Karpinsky 2001-09-04 11:39 ` Yuri Borunov 2001-09-04 11:55 ` [mdk-re] File creation time in Linux & others Henri Bourbon 2001-09-04 12:26 ` Vladimir Karpinsky 2001-09-04 15:27 ` Henri Bourbon [this message] 2001-09-06 10:53 ` Re[3]: " Vladimir Karpinsky 2001-09-04 12:56 ` [mdk-re] Re: скрипт из под крона не хочет перенаправлятьвывод Mikhail Zabaluev 2001-09-05 8:15 ` [mdk-re] Re: ÓËÒÉÐÔ ÉÚ ÐÏÄ ËÒÏÎÁ ÎÅ ÈÏÞÅÔ ÐÅÒÅÎÁÐÒÁ×ÌÑÔØ×Ù×ÏÄ Russu V.F.
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=10817968116.20010904152931@yahoo.com \ --to=npecca@yahoo.com \ --cc=mandrake-russian@altlinux.ru \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git