将文件信息存储在内存中 [英] Storing file information in memory

查看:100
本文介绍了将文件信息存储在内存中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个命令行实用程序来移动一些文件。我正在处理

数千个文件,我想知道是否有人有任何建议。


这就是我目前所拥有的:


$ arrayVirtualFile =

array(''filename''=>''filename'',

''basename''=> ;''filename.ext'',

''extension''=>''ext'',

''size''=> 0,

''dirname''=>'''',

''uxtimestamp''=>'''');


然后我遍历一个目录,每个文件我填充$ arrayVirtualFile

并将其添加到$ arrayOfVirtualFiles。

一个~2500个文件的目录占用我运行时大约~1.7 MB的内存

脚本。

任何人对于如何占用更少的空间都有任何建议吗?


谢谢!!

发自NewsLook(试用许可证)来自 HTT p://www.ghytred.com/NewsLook/about.aspx

I''m writing a command line utility to move some files. I''m dealing with
thousands of files and I was wondering if anyone had any suggestions.

This is what I have currently:

$arrayVirtualFile =
array( ''filename''=>''filename'',
''basename''=>''filename.ext'',
''extension''=>''ext'',
''size''=>0,
''dirname''=>'''',
''uxtimestamp''=>'''');

I then loop through a directory and for each file I populate the $arrayVirtualFile
and add it to $arrayOfVirtualFiles.
A directory of ~2500 files takes up about ~1.7 MB of memory when I run
the script.
Anyone have any suggestions as to how to take up less space?

Thanks!!
Posted by NewsLook (Trial Licence) from http://www.ghytred.com/NewsLook/about.aspx

推荐答案

arrayVirtualFile =

array(''filename''=>''filename'',

''basename''=>''filename.ext'',

''extension''=>''ext'',

''size''=> 0,

''dirname''=> '''',

''uxtimestamp''=>'''');


然后我遍历一个目录并为每个文件我填充
arrayVirtualFile =
array( ''filename''=>''filename'',
''basename''=>''filename.ext'',
''extension''=>''ext'',
''size''=>0,
''dirname''=>'''',
''uxtimestamp''=>'''');

I then loop through a directory and for each file I populate the


arrayVirtualFile

并将其添加到
arrayVirtualFile
and add it to


arrayOfVirtualFiles。

目录当我运行

脚本时,~2500个文件占用大约1.7 MB的内存。

任何人都有关于如何占用更少空间的建议吗?


谢谢!!

发自NewsLook(试用许可证)来自 http:// www .ghytred.com / NewsLook / about.aspx

arrayOfVirtualFiles.
A directory of ~2500 files takes up about ~1.7 MB of memory when I run
the script.
Anyone have any suggestions as to how to take up less space?

Thanks!!
Posted by NewsLook (Trial Licence) from http://www.ghytred.com/NewsLook/about.aspx


这篇关于将文件信息存储在内存中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆