由买买提看人间百态

topics

全部话题 - 话题: dirnam
1 (共1页)
xt
发帖数: 17532
1
来自主题: Java版 - Stupid IBM JDK

evidently
as
FYI, this is actually a known bug! I don't know if Sun JDK handles it right,
but IBM JDK, which came with my WebSphere, does not handle it right:
Class Util{
public static boolean check( File canonFile, String dirName)
throws SecurityException, IOException
{
File dir = new File( dirName );
if( !dir.isDirectory() ) throw new FileNotFoundException( dirName+ " is not
a directory");
// Find the most recent file in the directory
File[] files = dir.listFiles();
if( files==null || files.l
a**n
发帖数: 313
2
来自主题: Unix版 - my script Re: how would you do this?
change part of code to the new code, and let it to all sub-dirs:
#################Your code ##################
# put all files in an array
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
# put all files in an array
while (defined($file = readdir(DIR))) {
push @files, $file;
}
#############################################
##################New Code ###################
push @dirlist $dirname;
while(defined($curdir=pop(@dirlist))){
opendir(DIR, $curdir) or die "cannot open $c
c***z
发帖数: 6348
3
来自主题: Statistics版 - 问一个R的问题
能详解一下么
我倒是找到了一个法子
首先列出目录下的文件和子目录,文件直接下载,子目录调用本函数(递归)
但是下载下来的文件大小不对,大侠能帮忙看看么
library("RCurl")
# ==========================================================================
====
# Function that downloads files from URL
# ==========================================================================
====
fdownload <- function(sourcelink) {
# sourcelink <- ftp.root # test, root level
# sourcelink <- dirs[1] # test, second level
targetlink <- paste(dropbox.root, substr(sourcelink, nchar(ftp.root)+... 阅读全帖
c***z
发帖数: 6348
4
来自主题: Statistics版 - 问一个R的问题
I got a working version now:
#=====================================================================
# Function that downloads files from URL
#=====================================================================
fdownload <- function(sourcelink) {
# sourcelink <- ftp.root # test, root level
# sourcelink <- dirs[1] # test, second level
targetlink <- paste(dropbox.root, substr(sourcelink, nchar(ftp.root)+1,
nchar(sourcelink)), sep = '')

# list of contents
filenames <- getURL(sourceli... 阅读全帖
a**********0
发帖数: 422
5
来自主题: JobHunting版 - 发个我总结的unix常用命令
The Unix Commands
其实就是攒了一下网上的资料
# Create a new tar archive.
# the folder dirname/ is compressed into archive_name.tar
tar cvf archive_name.tar dirname/
# Extract from an existing tar archive
tar xvf archive_name.tar
# View an existing tar archive
tar tvf archive_name.tar
# Search for a given string in a file (case in-sensitive search).
grep -i "the" demo_file
# Print the matched line, along with the 3 lines after it.
grep -A 3 -i "example" demo_text
# Search for a given string in all files recur... 阅读全帖
s***k
发帖数: 23
6
【 以下文字转载自 Programming 讨论区,原文如下 】
发信人: stock (Microsoft is dead), 信区: Programming
标 题: Perl for programmers(12): Standard file modules
发信站: The unknown SPACE (Fri May 26 14:51:03 2000) WWW-POST
use File::Basename;
($name,$path,$suffix) = fileparse($fullname,@suffixlist);
fileparse_set_fstype($os_string); "VMS" "MSDOS" or MacOS";
$basename = basename($fullname,@suffixlist);
$dirname = dirname($fullname);
use File::Copy;
copy $src_file, $dst_file;
copy SRC_FILE,DST_FILE;
$fh = FileHandle->new("an
a*******e
发帖数: 3021
7
来自主题: Linux版 - 有人用chromium能看成flash嘛?
我是用一个launch-chrome.sh的脚本运行的
按照这个帖子
http://www.beefsack.com/blog/post/p/Google+Chrome+on+Fedora+11
Google Chrome on Fedora 11
脚本是
#!/bin/bash
export LD_LIBRARY_PATH=`dirname $0`/lib:$LD_LIBRARY_PATH
`dirname $0`/chrome
我试着再后面加上--enable-plugins也没用。
也许只能用系统安装rpm了
g****e
发帖数: 172
8
那些suspicious files安全吗?
多谢!!
sudo chkrootkit
ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
Checking `cron'... not infected
Checking ... 阅读全帖
p******g
发帖数: 347
9
来自主题: Programming版 - 求问C++问题
-Lfull/dirname/that/contains/the/lib/file -llib_file_name_without_leading_
lib_and_extension
你要知道是用的什么版本的库(是不是有debug symbols, 32bit or 64 bit, etc) 一
定要链接到正确的版本然后你自己的编译也使用同样的设置才行
然后需要把full/dirname/that/contains/the/lib/file 加入到环境变量路径里或者把
库文件放到你的要运行程序相同的路径下。
看来楼主估计基本的gcc都不太会用还是先编译运行一个简单的helloworld和知道创建
和链接库文件再说吧
g****e
发帖数: 172
10
【 以下文字转载自 Linux 讨论区 】
发信人: gangle (nothing), 信区: Linux
标 题: 请高手帮忙看看这个chkrootkit安全否?
发信站: BBS 未名空间站 (Mon Aug 13 18:29:14 2012, 美东)
那些suspicious files安全吗?
多谢!!
sudo chkrootkit
ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... ... 阅读全帖
m*****e
发帖数: 4193
11

"dirname $filename" returns the pathname
"basename $pathname" returns the last pathname
input: FILENAME
PATHNAME=`dirname $FILENAME`
BASEDIR=`basename $PATHNAME`
echo "${FILENAME}_${BASEDIR}"
x**g
发帖数: 807
12
来自主题: Statistics版 - .trn 后缀名是干什么的?
正在看一批数据,是SAS格式 (.sas7bdat),可是还带了一个同样文件名,不同后缀
名的文件(.trn)。请问这个.TRN文件是干什么用的阿?
在这批数据里还看到一个import的程序,是这样写的
%let dirnam = 'c:\folder';
%let trnnam = 'e:\folder\bbb010.trn';
libname dir &dirnam;
libname dirx xport &trnnam;
proc copy in=dirx out = dir;
run;
谁能帮忙解释一下阿?
y****3
发帖数: 131
13
【 以下文字转载自 Database 讨论区 】
发信人: yh1213 (yh), 信区: Database
标 题: An interview question: data store schema design
发信站: BBS 未名空间站 (Sat Mar 24 18:30:54 2012, 美东)
Design a backend store for storing metadata about files and directories
belonging to different users as part of an online storage service. The
logical data model is as follows:
--a user has zero or more files or directories
--a directory contains zero or more files or sub-directories
--a file or directory has a relative path that is up to 32K... 阅读全帖
y****3
发帖数: 131
14
Design a backend store for storing metadata about files and directories
belonging to different users as part of an online storage service. The
logical data model is as follows:
--a user has zero or more files or directories
--a directory contains zero or more files or sub-directories
--a file or directory has a relative path that is up to 32KB in length
--a file has a size and last modified time
This store should handle the following online queries efficiently:
--lookups on single files or sub-d... 阅读全帖
E*******s
发帖数: 42
15
来自主题: DotNet版 - 我的第一个小C#程序
今天才知道开了这个版.
我常常往我的homepage放照片给家人看,用这个小程序就一个directory 下面所有jpg
files自动产生一个thumbnail index html file,
很小, 不要见笑. 今天第一次用这个语言.
非常需要改进, 只是满足了今天upload照片的最低需要. 有时间可以添加新功能.
如果有人有更好建议和改进, 请一定开口.
我对C#和.net 的知识都近于零. 刚开始学习. 希望这里是个很好的学习group.
using System;
using System.IO;
using System.Drawing;
namespace edelweiss.album {
class generator
{
public static void Main(string[] args)
{
if(args.Length < 1) {
Console.WriteLine("Usage: album [directory name]");
return;
}
string dirName = arg
a***n
发帖数: 1616
16
来自主题: Java版 - [转载] JBuilder8只能装在rh上?
解决
cd Linux
vi ent_install.bin
uncomment following lines:
# glibc floating stack problem on Linux
if [ `uname -s` = Linux ]
then
case `uname -r` in
2.[456]*)
LD_ASSUME_KERNEL=2.2.5
export LD_ASSUME_KERNEL
;;
esac
fi
reference:
Linux shared libraries not found
When I try to run the install script I get messages as follows:
dirname: error while loading shared libraries: libc.so.6: cannot open shared
/bin/ls: error while loadin
l*******G
发帖数: 1191
17
Try all in one line:
find . -name Makefile |xargs -I {} dirname {} |xargs -I {} bash -c "pushd .
; cd {}; make clean ; rm -f .*.swp; popd"
i***r
发帖数: 1035
18
来自主题: Linux版 - 这个command 是什么意思?
q2=`cd `dirname $3`; pwd`/`basename $3`
请问谁能帮我break down一下?
多谢
O*M
发帖数: 120
19
dirname
c*****m
发帖数: 1160
20
dirname `pwd`
d**d
发帖数: 389
21
来自主题: Programming版 - 请教如何写这个宏
假如common_base_string = "/commonbase/dirname"
我想用宏给每个进程生成一个自己的 own_base_string = commmon_base_string_
xxxxxx, xxxxxx是根据 pthread_self()拿到的 pthread_it_t.
用的时间就是直接调用 GENERATE_OWN_BASE_STRING 宏。
{
char* own_base_string;
pthread_it_t pid=pthread_self();
own_base_string= GENERATE_OWN_BASE_STRING(pid);
}
请问如何写这个宏啊?
我用 # 和##, 但是都是直接输出 pid,而不是先evaluate pid的值,在传给宏。
非常感谢。
d****n
发帖数: 1637
22
来自主题: Programming版 - 问个临时抱佛脚的问题 (转载)
1. find a file by name/pattern
2. find a exact word/pattern in text file, counters of this pattern/word.
exclude this word/pattern in this file and do the same
3. sort a table(numbers) print unique counts by x column.
4. replace/insert/delete pattern/word in a text file.
5. rename/move/copy files from prefix/suffix "xxx" to "yyy"
6. given a table with numbers, calculate the average/sum/stdv at column x,y
,z
7. how/how many ways to detach a process when the process is running? before
it starts?... 阅读全帖
n*****t
发帖数: 22014
23
来自主题: Programming版 - linux, find command question
find | sort | awk
比较 last current 两行的 dirname,好像想不出更巧妙的办法 。。。

deepper
c********l
发帖数: 447
c********l
发帖数: 447
25
来自主题: Unix版 - [转载] Ftp 上传文件的问题
Under Sun Solaris:
To check your quota, type:
quota -v yourusername
To check the system disk usage, type:
du -k dirname
(let's say your home directory is /home/grad/username, you should try:
du -k /home/grad)
From the information you provided, there are two possbilities:
1. You are over quota
2. There are not enough disk space under the system, such as /home/grad
Probably it's because of the first reason, it's very easy to use more than
30M for a grad student, I use 180M, and many other students
f*****r
发帖数: 21
26
来自主题: Unix版 - 如何只列出文件

Thanks! 进一步,我想对一个目录及其子目录下的所有文件都进行同一种操作,
比如chmod 700 filename。我想用一个for循环实现。这个for循环在bash下面
怎么实现? Is it
for file in dirname;
chmod 700 file;
done
好象不太对。
k******d
发帖数: 8
27
来自主题: Unix版 - how to search a pattern in all files
recursively under a specific directory?
I write a perl, to recursive read files under all subdirectories, but failed
with error msg: "Bad symbol for filehandle" for the lime of code below:
if (!opendir($dirvar, $dirname)){
...............
so I'm thinking of "sac" or sth?
help!
t**c
发帖数: 97
28
来自主题: Unix版 - my script Re: how would you do this?
If the directory list need to be printed, I think it's better to use a hash
table %counter to count the number of times the filename appears:
####################################################################
my (%counter,%detail,@dirlist,$filename,$curdir);
# put all files in the hashes according to their filenames
push @dirlist,$dirname;
while(defined($curdir=pop(@dirlist))){
opendir(DIR, $curdir) or die "cannot open $curdir $!\n";
while (defined ($filename = readdir(DIR)))
{
if
j*****7
发帖数: 4348
29
来自主题: Statistics版 - SAS大牛给咨询一下
我的这段小code(把目录下所有的log文件集中起来), 在 Windows下运行没问题, 在
UNIX下就不行了。
filename getdir pipe "dir/b &dirname.*.log";
* Determine total number of LOG files to be processed;
data dirlist;
infile getdir length=len;
length fname $200;
input @;
input @1 fname $varying200. len;
fname=upcase(fname);
if substr(upcase(fname),1,1) in (&fprefix);
run;
是不是这个dir/b 在UNIX下不好使啊?
谢谢了。
j*****7
发帖数: 4348
30
来自主题: Statistics版 - SAS大牛给咨询一下
嗯, 换成filename getdir pipe "find &dirname.*.log" 就行了。
Thanks.
f***o
发帖数: 92
31
#!/usr/bin/perl


use File::Basename;


my $filename = "/nfs/sc/proj/jkt/jkt088/jmeng/jkt/FRZ1/rcbgfctls_frz1_ww43.3
";


print dirname($filename) . "\n";
split(/_/, basename($filename));
print $_[0] . "\n";
1 (共1页)