dap*_*hez 18 windows linux usb
我正在寻找一种解决方案,用于将所有文件从硬盘驱动器上的特定目录复制到 USB 存储设备上的特定目录,一旦该设备连接。
我有一个程序可以为我下载播客剧集。
我希望这些文件在我将它连接到计算机后自动移动(或至少复制)到我的 mp3 播放器。
我有 windows xp 和 linux 机器,所以它们中的任何一个的解决方案都适合我。
Pax*_*xxi 23
您可以使用 autorun.inf 和 .bat 文件轻松构建自己的 Windows 解决方案。
创建一个 bat 文件以将目录复制到您的 USB 驱动器。
xcopy /e /y c:\podcasts\*.* .\dir_on_usb_drive
Run Code Online (Sandbox Code Playgroud)
将 bat 文件放在您的 mp3 播放器上并使用这些说明创建一个 autorun.inf
现在你应该有你自己的问题的自制解决方案,但肯定有预制的解决方案在那里:)
Gru*_*bel 10
对于 Linux:
如果您不介意编写一些 Python 脚本,您可以编写一个守护程序来侦听 HAL 事件,然后在插入您选择的设备后启动脚本。示例脚本如下所示:
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import dbus
import dbus.service
if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
import dbus.glib
import gobject
import sys
import os
class DeviceManager:
def __init__(self):
self.bus = dbus.SystemBus()
self.bus.add_signal_receiver(self.device_added,
'DeviceAdded',
'org.freedesktop.Hal.Manager',
'org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager')
self.bus.add_signal_receiver(self.device_removed,
'DeviceRemoved',
'org.freedesktop.Hal.Manager',
'org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager')
def udi_to_device(self, udi):
return self.bus.get_object("org.freedesktop.Hal", udi)
def device_added(self, udi):
print 'Added', udi
properties = self.udi_to_device(udi).GetAllProperties()
if properties.get('info.category') == u'volume':
label, dev = properties.get('volume.label'), properties.get('block.device')
print 'Mounting %s on /media/%s' %(dev, label)
os.system('pmount %s /media/%s' %(dev, label))
def device_removed(self, udi):
print 'Removed', udi
if __name__ == '__main__':
m = DeviceManager()
mainloop = gobject.MainLoop()
try:
mainloop.run()
except KeyboardInterrupt:
mainloop.quit()
print 'Exiting...'
sys.exit(0)
Run Code Online (Sandbox Code Playgroud)
您只需修改该device_added()
函数以将其限制为特定设备并os.system()
用您的自定义脚本替换调用。
为了将其限制为驱动器,volume.uuid
可以使用该属性,并且可以使用该hal-device
程序显示可用属性的完整列表。
要在引导时启动守护程序,只需从/etc/rc.local
.
小智 9
Windows 7 并在插入时自动同步到您的闪存/USB 设备!
下载 SyncToy并建立您的文件夹配对和同步名称(“SyncTest”)
请参阅:操作方法:使用 SyncToy 制作我的文档的夜间镜像
您可以直接从 Task Scheduler 运行任务以验证它是否有效。现在我唯一遇到的另一个问题是用电池运行我的笔记本电脑,在任务管理器的条件选项卡下,取消选中“仅当计算机使用交流电源时才启动任务”,否则任务只会在插入交流电时运行。
此外,随着 USB 轮询和断开/重新连接,此任务将每隔几分钟运行一次,实际上有点酷,它一直自动同步到 USB 硬盘 :)
编辑:事实证明 SyncBack SE 有一个触发操作:
\n\n\n\n\n打开配置文件,转到\xe2\x80\x9c,当\xe2\x80\x9d选项卡时,然后\n\xe2\x80\x9c插入\xe2\x80\x9d。它允许您通过驱动器字母、标签或序列号进行指定。
\n
然而 SE 版本不是免费的并且仅限 Windows(我认为)
\n\n或者您可以尝试使用 TweakUI为同步程序(例如 SyncToy)添加自动运行事件
\n\n单击“应用”。
现在插入您的笔式驱动器。
我似乎找不到任何(其他)程序在您连接 USB 设备时会自动启动。
\n\n它们都依靠调度来开始同步。您可以决定每次都安排它,如果 USB 设备未连接,它就会失败,如果连接了,它就会运行。
\n\n但老实说,如果您只需单击同步按钮会更容易,您还必须手动插入 USB 设备。
\n\n不管怎样,我还发现了一个可以在 Linux 和 Windows 上运行的同步工具:DirSync Pro,它是完全免费的,在 Java 上运行,并且有一个漂亮的 GUI:
\n\n* Synchronization\n o Powerful synchronization algorithm.\n o Bidirectional (Two way) and Unidirectional (One way) synchronization mode.\n o Option for various behavior of conflict resolution for Bidirectional Synchronization.\n o Synchronizes unlimited number of folders.\n o Large number of options to change the synchronization behavior.\n o Option to synchonise subdirectories recursively.\n o Synchronizes files/folders any file system (FAT, FAT16, FAT32, NTFS, WinFS, UDF, Ext2, Ext3, ...).\n o Synchronizes files from/to network drives\n o Synchronizes files from/to any mounted devices (Harddisks, USB-Sticks, Memory cards, External drives, CD/DVD\'s, ...).\n o Synchronization could be used for making incremental backups.\n o Option to create up to 50 backups from the modified/changed files before synchronization.\n o Option to define a backup folder.\n o Option for handling symbolic links.\n o Option for handling time-stamps.\n* General\n o Easy, clear and user-friendly graphical user interface, no unnecessary gadget you never use.\n o Runs on every modern operating system including Windows\xe2\x84\xa2, Linux\xe2\x84\xa2 and Macintosh\xe2\x84\xa2\n o It is Portable! It does not need any installation. Just run the application!\n o Open source, it is 100% free of charge, 100% free of commercial text, 100% free of advertisements and 100% free of spyware.\n o No time/function limitations\n o Uses no local database, so no overhead\n o Does not need any installation. Just download and run it. You can put it on you USB-stick en you can run it on any computer/any platform.\n* Logging\n o Advanced logging/reporting facilities. Just select a log level and define where to write the log.\n o Option to log on application level (default log)\n o Option to log on each directory level (dir log)\n o Option to define the log leven (how much to log)\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
92423 次 |
最近记录: |